WordPress File Upload Using the Media Manager Gives PHP error

 
 
WordPress File Upload Using the Media Manager Gives PHP error

Issue
When using the media manager to upload an image in WordPress, you receive the following error:
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(C:\Windows\Temp\php*.tmp) is not within the allowed path(s): (C:\Inetpub\vhosts\(any domain)\httpdocs\) in C:\Inetpub\vhosts\(any WordPress domain)\httpdocs\wp-includes\functions.php on line 2505

 Cause
This error is caused by Plesk using open_basedir to deny uploads to any part of the server for PHP functions except for the document root (httpdocs), and WordPress is trying to create a temporary file in C:\Windows\Temp.

Resolutions
Globally
  1. Log in to Plesk on the server as the administrator account.
  2. Click Tools and Settings > Custom View Settings > PHP Settings.
  3. Under Common Settings where it says open_basedir select the radial for Enter custom value and set this to {DOCROOT}\;\Windows\Temp\.
  4. Click OK.
  5. Log out of Plesk and restart Plesk services.
NOTE: This change will only propagate to new domains created on the server after the change has been made. This fix will need to be retroactively applied to the domains already on the server using the steps in the Per Domain resolution. The domains that are already on the server will continue to have this problem until the fix is applied to them.
 
Per Domain
  1. Log in to Plesk on the server as the administrator account.
  2. Click Domains > (the domain) > Websites & Domains.

     
  3. Expand Advanced Operations.

     
  4. Click Website Scripting and Security > PHP Settings .


     
  5. Under Common Settings where it says open_basedir select the radial for Enter custom value and set this to {DOCROOT}\;\Windows\Temp\.
     
  6. Click OK.
  7. Recycle the domain's application pool to make sure it is using the updated php.ini that Plesk creates.
The fix should now be applied, and WordPress image uploads no longer give an error.

Note: Servers should now be provisioned to globally change the open_basedir settings. If this issue occurs, contact our developer/infrastructure team to make them aware the steps were omitted during the server provisioning process.

Add Feedback