I have installed Apache and PHP on a Windows 10 developer 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 <?php> 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 have changed in the http.conf file:
OLD SETTING:
DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
NEW SETTING:
#DocumentRoot "${SRVROOT}/htdocs"
DocumentRoot "C:/WWW"
#<Directory "${SRVROOT}/htdocs">
<Directory "C:/WWW">
When I change it back again, PHP works just fine.
I have also tried changing the doc_root
setting in php.ini
, but that does not help. Apache loads the .php page, but does not send it to the php server.
Thank you for responding. The problem was a minor one. In the fresh install of PHP 5.3, the short_open_tag
in PHP.ini
was defaulted to Off
. The phpinfo file in the Apache directory opened with <?php>
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. In newer versions of PHP ... from 5.4 on up, the short open tag <?>
will always work, regardless of the short_open_tag
setting.
Simple little things can sometimes trip us up.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.