How to solve 500 Error when clicking on image in WordPress

How to solve the 500 Error problem when clicking an image on your WordPress site.
This is fairly simple..

What happend?

The image issue is a permission issue. The behavior of WordPress is that it writes the original file using the computers “IUSR” user to a temporary system directory that has been defined in the PHP.ini file (Located in the PHP directory. Usually in the “Program Files” folder). This temp folder does not have IIS_IUSRS permissions set on it, so when windows moves this file from the temp folder to the WordPress upload folder, the permissions are not inherited from the file’s parent folder. In other words, it keeps the temporary folders permissions.

 

So, How to solve this

We have two solutions to fix this problem.

Solution 1:

Change the permissions on the temp folder listed in the PHP.INI file by giving IIS_IUSRS write/modify.
As the PHP.INI file contains A LOT of characters you can easily find the Temp folder by searching for: upload_tmp_dir

Solution 2:

Change the path of the temp folder in the PHP.INI file to a folder that already got the IIS_IUSRS write/modify permission.

I have done this, but it still gives me the 500 error

We had the pleasure of still getting the 500 error after changing the permissions. So what we found out was that some of the files that had already been moved still had the “old” permissions.
So to solve this you right click on the upload folder in WordPress structure, and hit

“Properties” -> “Security” -> “Advanced” -> “Owner” -> “Edit”How to set ownership

Select your own name, and tick the box at the bottom. Then hit “Apply” and “OK”.

Now, switch tab to “Permissions” and click “Change Permissions”. Here you just need to tick the “Replace all child object permissions….” and hit “Apply” and “OK”.

And that should solve the problem.

#Free Tip: We had to restart the PHP service for the change to take place. (Or restart the server\computer if you don’t know how to restart a service)

Leave a Reply