Search code examples
phpwindowconfiguration-files

PHP - doc_root value not taken into account


I downloaded the last version of php (currently php 7.2.8) for a Window 10 desktop, more specifically the VC15 x64 Thread Safe.

After defining a shortcut as :

C:\Users\c2ll0fd00m\Downloads\php-7.2.8-Win32-VC15-x64\php.exe -c php.ini -S 0.0.0.0:8000

I was able to run perfectly PHP on a small index.php file (in fact just performing a simple phpinfo() call.

But after editing the php.ini file and set the value of doc_root to another folder like c:\php\root, when I launch the php.exe, the command line still displays the old document root value instead of the new one.

More strange, when I let the index.php in the php.exe folder, then the phpinfo() shows that the doc_root is correctly set with the new value c:\php\root.

The consequence if that with the index.php file in the c:\php\root folder then the url http://localhost:8000/ is not reachable anymore.

So to summarize this, PHP seems to not take into account the value of doc_root.

What should I do?

PS: I already apologize for my english, I am not a native english speaker.


Solution

  • doc_root is not used by the PHP web server

    http://php.net/manual/en/features.commandline.webserver.php

    Use the -t flag to specify a specific directory, or just launch the PHP web server from the directory you wish to use.

    php -S localhost:8000 -t foo/