I created a dir named "test", and inside this dir, i created 3 files: 1.jpg, 2.html and 3.php. If i run php -S localhost:80
and try to visit localhost/3.php, it works. But if i visit 1.jpg or 1.html, or any file that is not a php, it gives me a 404 not found error. I'm using PHP 7.1 NTS on Windows 10. I tried with PHP TS and PHP 7.2 but the error persists.
Built-in web server ¶ This web server is designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server.
On most servers, this is the default extension for PHP files, but ask your server administrator to be sure. If your server supports PHP, then you do not need to do anything. Just create your . php files, put them in your web directory and the server will automatically parse them for you.
XAMPP is a Web development tool, created by Apache, that makes it easy to run PHP (Personal Home Pages) scripts on your computer locally.
Step 1: The client requests the webpage on the browser. Step 2: The server (where PHP software is installed) then checks for the . php file associated with the request. Step 3: If found, it sends the file to the PHP interpreter (since PHP is an interpreted language), which checks for requested data into the database.
The issue may be caused by the accented e in your file path, please test in a different location. Why does PHP built-in web server not serve file called é.txt (on Windows)
I had a similar problem: my php page would display fine but no other page, including images on the php page would be served. The problem was asking the php development server to serve a specific page:
php -S 127.0.0.1:8000 myPage.php
Rather than:
php -S 127.0.0.1:8000
In the later I have to include myPage.php
in the url, but images and other files now display.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With