• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • The ImunifyAV extension is now deprecated and no longer available for installation.
    Existing ImunifyAV installations will continue operating for three months, and after that will automatically be replaced with the new Imunify extension. We recommend that you manually replace any existing ImunifyAV installations with Imunify at your earliest convenience.

Issue php move_uploaded_file failed to open stream: Permission denied

JollyCasfer

New Pleskian
Hi there. I'm new to plesk and I always receive this error "move_uploaded_file(G:/PleskVhosts/test/test.com/sample.JPG): failed to open stream: Permission denied in G:/PleskVhosts/test/test.com/sample.JPG on line 43" whenever I try to upload image using php. I tried to add the folder directory to open_basedir but it doesn't solve the problem. I tried to upload the file in C:\Windows\Temp folder and it worked but I saw some post that says it's bad practice and I can't retrieve the image using the <img src> tag. Am I missing anything like more configuration or something?
 
Make sure that:

1. Check that {TMP} directory is added to open_basedir on Home > Domains > example.com > PHP Settings page
open_basedir1.png
It is environment variable for C:\Windows\Temp\

If it is required to add some custom directory to open_basedir parameter it can be done as follows:
open_basedir.png

2. IWPG_user, where user is a system user of the subscription who has rights to "Read", "Write" and "Modify" the %windir%\Temp directory. On the screenshot below, the system user of the subscription example.com is an example and the corresponding application pool group is WPG_example:
sys_user.PNG

3. The destination folder from the error message exists in the %plesk_vhosts%\example.com\httpdocs\ directory and the system user from the previous step has similar access rights.

Note: If the destination file is located inside a directory, these permissions must be set to this directory as well (e.g. ./images/)

4. safe_mode and safe_mode_exec_dir parameters of the PHP handler are disabled.

It can be checked on the phpinfo() page of the domain: Plesk > Domains > example.com > PHP Settings > View the phpinfo() page.
If one of options is enabled, disable it by adding a corresponding value in the additional directive at Plesk > Domains > example.com > PHP Settings > Additional configuration directives, for example:

Code:
safe_mode_exec_dir = Off
 
Back
Top