Changing documentroot in Apache http.conf file causes PHP to stop working
-
Hello:
Windows 10 workstation
Apache 2.4
PHP 7.2.I've installed Apache and PHP on a Windows 10 workstation and everything (including PHP) works beautifully. But when I change the documentroot in the http.conf file, Apache stops sending .php files to the PHP engine. Apache opens the .php files in the new directory, but the code no longer gets parsed and processed by the php engine (php.exe). Apache no longer runs those files through the php module.
Here is what I've changed in the http.conf file:
OLD SETTING:
DocumentRoot "${SRVROOT}/htdocs"NEW SETTING:
DocumentRoot "C:/WWW"When I change it back again, PHP works just fine.
I've also tried changing the doc_root setting in php.ini, but that doesn't help. Apache loads the .php page, but never sends it to the php server.
Any thoughts or help?
Thanks!
-
Hello:
Windows 10 workstation
Apache 2.4
PHP 7.2.I've installed Apache and PHP on a Windows 10 workstation and everything (including PHP) works beautifully. But when I change the documentroot in the http.conf file, Apache stops sending .php files to the PHP engine. Apache opens the .php files in the new directory, but the code no longer gets parsed and processed by the php engine (php.exe). Apache no longer runs those files through the php module.
Here is what I've changed in the http.conf file:
OLD SETTING:
DocumentRoot "${SRVROOT}/htdocs"NEW SETTING:
DocumentRoot "C:/WWW"When I change it back again, PHP works just fine.
I've also tried changing the doc_root setting in php.ini, but that doesn't help. Apache loads the .php page, but never sends it to the php server.
Any thoughts or help?
Thanks!
Somewhere else in your httpd.conf there will be some configuration that makes PHP work. Search the file for "php" and see what you can find, then check that it isn't in its own <Directory> group or something similar. If you can't find anything about PHP in the main file, look for
Include
lines - the httpd.conf can include other files, so you might have one that is specific to PHP. The php.ini file is read by PHP itself, and it doesn't sound like it is getting that far. -
Somewhere else in your httpd.conf there will be some configuration that makes PHP work. Search the file for "php" and see what you can find, then check that it isn't in its own <Directory> group or something similar. If you can't find anything about PHP in the main file, look for
Include
lines - the httpd.conf can include other files, so you might have one that is specific to PHP. The php.ini file is read by PHP itself, and it doesn't sound like it is getting that far.Thank you for responding. The problem was a minor one. In the fresh install of PHP, the "short_open_tag" in PHP.ini was defaulted to "Off". The phpinfo file in Apache directory opened with "" and the file in the new directory opened with "", so it didn't parse. I've changed the php.ini file with "short_open_tag = On" and all is well now.
Simple little things can sometimes trip us up.
-
Somewhere else in your httpd.conf there will be some configuration that makes PHP work. Search the file for "php" and see what you can find, then check that it isn't in its own <Directory> group or something similar. If you can't find anything about PHP in the main file, look for
Include
lines - the httpd.conf can include other files, so you might have one that is specific to PHP. The php.ini file is read by PHP itself, and it doesn't sound like it is getting that far.I made this website[
Tom Ford Perfume Collection
](https://branddose.com/brands/brands-tom-ford/)in Javascript with custom coding check it out