PHP 500 internal server error in IIS – Causes and Fixes

500 internal server error clearly indicates that one thing went incorrect for the duration of the show of PHP web page.

By default, internet servers like IIS return only generic error messages in internet websites. Generally, this causes the masking of true explanation for IIS PHP errors such as 500 internal server error.

That’s why, we regularly get request from Windows server owners to obtain out the explanation for PHP internet site errors and repair them as portion of our Server Management Solutions.

Right now, we’ll take a appear on how Bobcares’ Engineers track the true explanation and repair php 500 internal server error in IIS.

&nbsp

What causes PHP 500 internal server error in IIS

Fundamentally, 500 Internal Server Error is IIS internet server’s way of saying, “A thing has gone incorrect when I attempted to show the web page. Not confident what.

Now, its time to see the precise causes for the 500 errors.

&nbsp

1. Permissions Error

From our knowledge in managing servers, our Windows Authorities frequently see PHP 500 internal server errors due to incorrect permissions and ownership on internet site files. In Windows servers, each and every file and each and every folder has its personal set of permissions. Once more, some permissions are inherited from the parent folders also. And, when the PHP binary do not have sufficient permissions to execute the scripts, it can outcome in 500 internal server error.

Similarly, ownership of the files also build issues. In Windows, precise customers like IIS User, IIS WP User, and so forth. must have access on the internet site folders and files. For instance, the IUSR account must have modify permissions on php scripts. And, when there are permission issues, internet site shows PHP errors.

&nbsp

2. Terrible PHP Settings

However a different explanation for PHP internal server error is undesirable PHP settings. The PHP settings are specified in the configuration file at C:PHPPHP.ini. PHP binary take the values from this file whilst executing scripts.

A classic instance will be PHP timeout settings. When the internet site PHP scripts has to fetch final results from external sources, PHP timeout values frequently trigger difficulty.  Most program administrators set timeout values in PHP to prevent abuse of the server sources. And, if the PHP script executes for a time longer than the threshold limits, it ultimately final results in 500 error.

&nbsp

3. PHP module errors

A really couple of 500 errors come about when the PHP module on the server as such becomes corrupt also. As a outcome, it final results in processing failure of PHP scripts.

Fortunately, when the internet site reports the 500 error due to module failures, IIS frequently show a additional precise error messages like:

500.0 Module or ISAPI error occurred.
500.21 Module not recognized.

&nbsp

How we fixed PHP 500 internal server error in IIS

Fixing PHP 500 internal server error in IIS need to have a series of measures. Let’s now see how our Devoted Engineers fixed it for 1 of our clients and created PHP scripts operating.

The consumer reported 500 internal server error on WordPress internet site operating in IIS.

&nbsp

1. Turning On Show errors

Whilst the error properly recommended that PHP had triggered 500 error code, it did not offer application-precise information and facts about what triggered the error. Hence, the the 1st step of investigation was to turn ON show errors solution. For this, our Devoted Engineers followed the measures under.

  1. Applying Windows® Explorer, browse to C:PHP and open the Php.ini file in the PHP installation directory.
  2. Edit and set the show_errors = On directive.
  3. Save the file.
  4. Reset IIS making use of the command iisreset.exe

Just after turning on the errors, we reloaded the PHP and it showed a PHP parse error:

Parse error: parse error in C:inetpubusersxxxhttpdocsmysiteerror.php on line 3 >>

Generally browser settings only show friendly error messages. In such situations, we advise consumer to turn it Off. For instance, in World-wide-web Explorer Go to Tools, World-wide-web Choices, Sophisticated tab, and then clear the Show friendly HTTP error messages verify box.

Hence, it was a coding error on the PHP script. We recommended script modifications to consumer and that fixed the error.

&nbsp

2. Operating PHP script locally

However a different way to obtain the precise error is to run the challenge php script inside the server. For this, our Help Engineers connect to the server through rdesktop and execute php script making use of the php.exe binary. It would show the  DLL’s that are obtaining conflicts and causing the 500 error. We repair these conflicts and make the script operating once more.

&nbsp

3. Correcting PHP settings

In some situations, we need to have to right the PHP settings to get the challenge solved. Lately, when a consumer reported issues with his internet site, we had to set the php directive open_basedir properly to resolve 500 Internal Server Error.

Similarly, when PHP cgi scripts show up some warning, IIS7 nonetheless displays an HTTP 500 error message. Even though the greatest technique is to repair the PHP scripts, frequently altering the default error handling for FastCGI in IIS7 to “IgnoreAndReturn200” also function as a short-term repair. The precise settings will appear as shown.

&nbsp

4. Fixing PHP binary

In some uncommon situations, the repair may well involve full rebuilding of PHP binary on the server. This takes place primarily when the PHP plan on the server becomes corrupt. Nonetheless, in such situations our Devoted Engineers normally verify the dependency of the package and do the reinstall. For manage panel precise servers, we set the proper binary on the server.

[Broken PHP scripts causing big problems? Our IIS experts have the fix for you.]

&nbsp

Conclusion

In a nutshell, PHP 500 internal server error in IIS takes place primarily due to causes like buggy PHP scripts, incorrect server settings and quite a few additional. Right now, we saw the prime causes for the error and how our Help Engineers repair it for clients.

The post PHP 500 internal server error in IIS – Causes and Fixes appeared 1st on Bobcares.