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.
- Log into the server using Remote Desktop
- Click on Start > Run> type regedit.
- Navigate to HKEY_LOCAL_MACHINE -Software - Wow6432Node - PHP - Per Directory Values - C - Inetpub - vhosts - [domain] - httpdocs.
- Click on open_basedir and delete it.
- 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.
- Verify you can add an image to the page or article of the website.
Article ID: 719, Created: June 7, 2012 at 10:38 AM, Modified: February 26, 2013 at 9:26 AM