Reputation: 49
In Windows, I'm succesfully using PHP built-in web server with a custom path as a root folder and my own php.ini file using this command line:
php.exe -S localhost:80 -t c:\custom\path -c php.ini
But whenever the custom path has a space character it fails and the server refuses to initialize, so using 'localhost' as URL gives a connection timeout error. It works fine if no spaces in path name.
I've tried using quotation marks before and after the path name and also replacing spaces with +
character or %20
with no luck.
Not working samples:
php.exe -S localhost:80 -t c:\my custom\path -c php.ini
php.exe -S localhost:80 -t "c:\my custom\path" -c php.ini
"php.exe -S localhost:80 -t "c:\my custom\path" -c php.ini"
Any suggestion is very much appreciated.
Upvotes: 1
Views: 529
Reputation: 33403
The order of arguments matter when starting PHP.exe
If you execute it with -c
option before -t
option it should work.
As for the path with spaces it needs to be enclosed in double quotes.
As an example this is what I tried on my local Windows machine:
php.exe -S localhost:80 -c php.ini -t "C:\xampp\htdocs\formatter - Copy\"
Upvotes: 4