Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Changing documentroot in Apache http.conf file causes PHP to stop working

Changing documentroot in Apache http.conf file causes PHP to stop working

Scheduled Pinned Locked Moved Web Development
phpapachesysadminhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MontanaMan
    wrote on last edited by
    #1

    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!

    G 1 Reply Last reply
    0
    • M MontanaMan

      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!

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      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.

      M B 2 Replies Last reply
      0
      • G Graham Breach

        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.

        M Offline
        M Offline
        MontanaMan
        wrote on last edited by
        #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 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.

        1 Reply Last reply
        0
        • G Graham Breach

          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.

          B Offline
          B Offline
          Branddoseco
          wrote on last edited by
          #4

          I made this website[

          Tom Ford Perfume Collection

          ](https://branddose.com/brands/brands-tom-ford/)in Javascript with custom coding check it out

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups