1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Changing documentroot in http.conf stops PHP from working

Discussion in 'Apache' started by MontanaMan, Oct 9, 2020.

  1. #1
    Hi:

    I've installed Apache 2.4 webserver with PHP 7.2 on a Windows 10 workstation. Everything works beautifully until I change the documentroot in Apache's http.conf file. When I change it, php files in the new home directory don't get parsed by PHP. Apache stops sending .php files to the php engine, and the .php files load like an ordinary file. I see the .php loaded in the web brower, but only the <html> portions of the page are shown. <?php> sections are treated as ordinary text.

    Here's what I 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 do that, Apache goes to the new directory, but stops sending .php files to the PHP engine.

    Any ideas what I'm doing wrong?

    Thanks!
     
    MontanaMan, Oct 9, 2020 IP
  2. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #2
    JEET, Oct 9, 2020 IP
  3. MontanaMan

    MontanaMan Peon

    Messages:
    2
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Thank you for responding. The problem was a minor one. In the fresh install of PHP, the "short_open_tag" in PHP.ini was set to "Off". The phpinfo file in 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.

    Simple little things can sometimes trip us up.
     
    MontanaMan, Oct 10, 2020 IP
    JEET likes this.