Error 500 after file upload in WordPress using IIS 7.x


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/13/d121821522/htdocs/mvt/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

Problem:  After uploading a file within WordPress and trying to link the file, I would get an Internal 500 error when clicking on the link.  If I got on the server, renamed the file and then renamed it back, the link would work.  This was a Windows 2008 server using IIS7 and was starting to look like a rights issue.

Solution:  Turned out to be a rights issue and it had nothing to do with WordPress or IIS for that matter.  It had to do with rights regarding to the PHP upload function.  Basically when a file is uploaded via WordPress, PHP copies the file to a temp location (c:\windows\temp is default) and the copies it the the appropriate WP folder.   The problem was that the file was inheriting the rights from the windows\temp directory which were too strict for the website.  I created a new directory (C:\uploadtemp), made sure that rights were what I needed them to be and then changed the PHP.ini to reflect this new temp upload directory.   Problem solved…

Leave a comment

Your email address will not be published. Required fields are marked *