PHP Based Apps Can't Insert Images Using Built-in Media Manager

Plesk Servers > Troubleshooting
PHP Based Apps Can't Insert Images Using Built-in Media Manager

Issue
  • When inserting an image in WordPress, the user gets an HTTP error
  • When inserting an image in Joomla, the user gets an unable to upload file type. When changing general settings in WordPress, user gets the following error:

Warning: file_exists() [Function file-exists]: open_basedir restriction in effect. File(/.htaccess) is not within the allowed path(s): (C:\Inetpub\vhosts\domain.com\httpdocs\) in C:\Inetpub\vhosts\domain.com\httpdocs\wp-admin\includes\misc.php on line 133

Cause
Plesk 10 stores each domain's individual PHP settings in the Windows registry. By default, Plesk 10 adds the open_basedir key to the registry for each domain that it installs on the server. The open_basedir function defines the locations or paths from which PHP is allowed to access files. If a file is outside of the paths defined by open_basedir, PHP refuses to open it. Its objective is mainly to avoid accidental modifications to parts of the filesystem. It can also be used to mitigate the effect of vulnerable PHP scripts on the files ystems.

Solution
Because modifying the registry key and changing permissions for c:\Windows\Temp only works for WordPress and not Joomla sites, our current fix for this issue is to log into the server, edit the registry and remove the open_basedir entry for each domain. Please contact the support team for assistance with this issue.
  1. Log into the server using Remote Desktop
  2. Click on Start > Run> type regedit.
  3. Navigate to HKEY_LOCAL_MACHINE -Software - Wow6432Node - PHP - Per Directory Values - C - Inetpub - vhosts - [domain] - httpdocs.
  4. Click on open_basedir and delete it. open_basedir in Registry
  5. Also remove the safe_mode key because even though it's set to off, for some reason some plugins or modules report that PHP Safe Mode is on.
  6. Verify you can add an image to the page or article of the website.

Add Feedback