Category systems

Read about the posts of category systems

How to fix ISPConfig + NGINX + WordPress = ERROR 500?

A few months ago, one of my servers with WordPress, made error 500, each time a user made an action.

After searching unsuccessfully in Google and various forums, I began to debug the situation, beginning to see what was going on with WordPress and to find out what was the source of the problem.

 

Problem

We installed a server with Nginx, all of our servers use Nginx, working perfectly with a lot of sites configured. A customer asked us to install WordPress. Normal situation. But a few days later, the client called us because sometimes appears a yellow screen with a 500 message error.

 

ispconfig-wordpress-error500

We decided to investigate a little bit, debugging WordPress, and we detected that happen.  WordPress, sometimes, runs a line with the instruction wp_die(). Isn’t normal termination, but sometimes, execution finish with this instruction.

This function sends a message to the user, but also add a 500 error in the packet header returned to the browser. This is normal behaviour, but the browser, instead of showing a message are showing an ISPConfig error 500 pages.

Here, we decide to investigate nginx. And why is sending the yellow 500 error page?

Explanation

After a lot of time and config files, finally, I found that the site has special config lines in the Nginx configuration file. Let’s see, the configuration:

And, other lines similar:

These instructions force nginx to send the page with Error 500.

Solution

If you see the config file, you will notice that have files called with numbers inside the errors folder. I don’t put the files there, so, ISPConfig put files there.

Then, the solution is so simple that … whatever!

ISPConfig has an option in the sites’ configuration called Own Error-Documents:

ispconfig-web-domain-error500

 

So, to run WordPress must be unchecked the option Own Error-Documents.

When you uncheck this option, ISPConfig deletes the code of the nginx configuration and the errors folder.
So WordPress runs perfectly now, sending messages to the browser.

One of the worst things that could have happened to me upgrading to Mac OS X 10.10.1 Yosemite is the fact that reset the configuration of Apache / PHP. Basically, deleted the php.ini file (among other things) and get text and mcrypt libraries.

The first thing we do is install gettext in Yosemite. I am not sure if this step is absolutely necessary.

I usually work in the tmp folder and restarting the Mac (though I do not ever do) is automatically deleted. We open the Terminal and put:

gettext

Download gettext-tools

In my case, the version 0.19.3, enter into the folder and compile:

Now that we have gettext-tools, compile PHP extensions. For this, use GIT:

Again tmp:

And download the PHP sources :

It will be one while downloading code, the PHP project is not tiny. We switched to the branch of our version of PHP:

And finally, compile the extension:

Now we have the extension, copy the folder extensions:

The folder name may vary depending on the version of OS X.

Now edit php.ini (if you do not have php.ini cp /etc/php.ini.default /etc/php.ini):

Go to the end of the file and add:

mcrypt

Now, the extension mcrypt. The process is identical to gettext:

Copy of the folder the extensions:

Now edit php.ini :

Go to the end of the file and add:

Restart apache:

Conclusion

Yosemite is fast, Yosemite is nice but has not taken into account, in any case, developers who use the Mac as a development environment.