Apache, on what operating system?
The PHP Practitioner
HI! dear I am going to start this series again because I am not understanding where I am wrong and no solution works for me. Can anyone help me how to set the document root so I can do my work?
this is the link of which I am facing the problem I posted the question on StackOverflow also https://laracasts.com/discuss/channels/requests/redirecting-url-problem
StackOverflow link
Thank you so much.
Document root is where you want php scripts to run.
I don't know about The PHP Practitioner, but here is an example, look over this folder structure:

In an index file you point to where main program is. For example before moving main app out of htdocs (public_html, www) you have:
require __DIR__.'/../vendor/autoload.php';
after moving above htdocs, correct folder has to be adjusted, pointed to:
require __DIR__.'/../../laravel54up/vendor/autoload.php';
notice the:
/../../
The above assumes index.php is in the webroot. In example that would be: laravel54 folder.
In htaccess you can also add this line:
RewriteEngine On
# add this, use your url
RewriteBase /laravel54/
Sorry I know of any other way to explain. If NGINX just look up that setup.
@SNAPEY - linux operating system Ubuntu 18.4
@JLRDW - Thank you so much, my bro!
I want to work on basic PHP I think the document root structure you share with me is Laravel. can you explain to me a bit more?
Thanks
You know the source is on github:
https://github.com/laracasts/The-PHP-Practitioner-Full-Source-Code
Just for demo, I don't think Jeffrey sets this code above webroot. It is just for learning in development.
https://www.dyclassroom.com/howto-ubuntu/how-to-change-document-root-of-apache-on-ubuntu
Or, if you want to run multiple websites on the same server, you need to look into Virtual Hosts
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
@JLRDW - I clone it on my laptop and run it but it throws the exception Fatal error: Uncaught exception 'Exception' with message 'No route defined for this URI.' in /home/ubuntu/workspace/learnPHP/core/Router.php:27 Stack trace: #0 /home/ubuntu/workspace/learnPHP/index.php(6): Router->direct('learnPHP') #1 {main} thrown in /home/ubuntu/workspace/learnPHP/core/Router.php on line 27
@SNAPEY - HI! dear snapey !
I did this process but not working just show page not found.
https://www.dyclassroom.com/howto-ubuntu/how-to-change-document-root-of-apache-on-ubuntu
also, I uninstall the xampp and then install PHP MySQL apache manually then run the code noting happen.
just home page open successfully other all links show
Not Found
The requested URL /about was not found on this server.
Apache/2.4.29 (Ubuntu) Server at localhost Port 80
why this happens can you please help me to sort it out.
No route defined for this URI
Have you modified your httpd.conf file
From
AllowOverride None
to
AllowOverride FileInfo
Or do equivalent if NGINX, see their docs.
@JLRDW - HI! dear jlrdw. I made changes but notings gets change
<Directory />
Options FollowSymLinks
AllowOverride FileInfo
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride FileInfo
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride FileInfo
Require all granted
</Directory>
<Directory /srv/>
Options Indexes FollowSymLinks
AllowOverride FileInfo
Require all granted
</Directory>
I made this change in apache2.conf because in my system there is no file with the name of httpd.conf
and when I make the .htaccess file and add this line of code then It shows this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.29 (Ubuntu) Server at localhost Port 80
also try
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Thank you so much
HI! can anyone answer!!!!
The section of httpd.conf to change is:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
# AllowOverride None ////// old
AllowOverride FileInfo
Please or to participate in this conversation.