PHP error 404 on IIS server – How did I solve the error.


I was working on IIS server and trying to run php but got 404 errors on all pages. Although static files were working fine but php were not.

In this article I will discuss all the possible ways you can try and check in order to run your php scripts.

1. Check if php file exists in your directory

Well, its a rookie mistake. Sometimes we falsely use wrong path and stay confused for hours. That’s why it is recommended to double check the file location. Generally, in case of IIS, you put your server files in –


2. Check file extension

This is one of the culprit which gets overlooked easily. Sometimes windows hide the file extension and it gets hard to catch it. For example, what if your file is saved as index.php.txt? Windows will hide the extension and will show you only index.php.

As a precautionary measure, you can instruct windows to always show the extensions in files & folders list. To open this option, got to view and check file name extensions option. Refer this image –

3. Check for fastCGI binding in server configuration

IIS runs different scripts like php, python, ruby etc. with the help of their cgi applications like php-cgi.exe. So, it is necessary to instruct IIS to use php-cgi.exe to run php scripts. This is done with the help of fastCGI option in IIS manager.

Click on Handler Mappings and then on add module mappings

A window will open; from where you can fill the mapping information. Refer this below image –

Just replace the php-cgi.exe path with the one corresponding to your php installation.

Restart IIS server and check if php files are working.

4. Make and copy of php.ini and save it with name php-cgi-fcgi.ini

This is a important step as fastCGI looks for php-cgi-fcgi.ini file. You need to make a copy of php.ini file and save it with the name php-cgi-fcgi.ini.

With the help of these steps, your problem of 404 error on php scripts on IIS server will solve.

    Tweet this to help others

Sign Up for Our Newsletters

Get only the best articles delivered to your mail