• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

PHP upload files to different domain on the server

NedMoody

New Pleskian
Hello,

We have Plesk panel (11.5.30) on our server to run our company websites. PHP is executed as FastCGI.
We have one site (set as subscription and domain) that is our administration system. We use it to manage the content of all other websites on the server (again set as subscriptions and domains).

The problem is, that our admin system has to upload images to the coresponding domain/site, so the images are accessable through the site domain directly. But currently we can upload/create files etc. only in the "admin system" domain tree. It can't access any other domain outside the admin system.
I've tried to set chmod to even 777 for the destination directories where the images should be uploaded. I've tried to chown these directories to adminsystem:psacln (same as the ownership of the admin system directories), but again with no success.

Please give me some advice. It's really important for us to manage all our websites from one place - our admin/content management system.

Thanks,
Ned
 
Hi,

I know this is probably not what you wanted to hear.
The easiest way to get around this issue is to create a single subscription with your admin interface and your customer domains/subscriptions.

However to still try and help:
Which OS, which PHP Version are you using?
Is safe_mode enabled?

Try the following on the shell as root:
# su -s /bin/bash $USEROFADMINSUBSCRIPTION
$ whoami

This should now return the Username of the Subscription that has the Admin Script installed.
Now try and navigate to a customer subscription via "cd DIR":

$ cd /var/www/vhosts/domain.tld/httpdocs/images
$ touch testfile

Are the above commands possible? If not you still have an issue with your permissions.

My guess is you have safe_mode enabled in PHP and open_basedir restrictions are your problem.
But then again, it's only a guess :)

Regards,
Kristian
 
Hi, Kristian,

Thank you for your reply.

I'm using CentOS 6.4 and PHP 5.3.3. Safe mode is not enabled. I've also set the open_basedir setting to none.

Tried the commands you gave me, but I'm not able to access my images dir with cd. It says access denied.
It's strange, because when I "ls -all" my destination directories I see that my "images" dir has the same rights and ownership as the "images" dir in my adminsystem where uploading images works. Both are set as adminsystem: psacln and both has full write access. Where am I wrong? Is there something more than chmod and chown that I should run in order to give access?

Thank you!

ps: Moving subscriptions to the admin subscription is not too bad solution and will be probably my last try. The problem there is that the admin system and the typical websites should have different IPs.
 
Hi NetMoody,

have you tried to enter each Directory up the line?
Try the above command the following way:
Code:
# su -s /bin/bash $USEROFADMINSUBSCRIPTION
$ cd /var/
$ cd www
$ cd vhosts
$ cd domain.tld
$ cd httpdocs
$ cd images

As of where do you get a permission denied?

Regards,
Krsitian
 
yes, I tried each dir separately and I got permission denied on the "cd domain.tld".
But I thought I should set the ownerships only to the final/destination images dir... now when I set all dirs in the path to adminsystem: psacln and adminsystem: psaserv I succeeded to upload a file! whow! thanks a lot, but is it ok to change the ownership of all the directories in the path?

Thank you!
 
Hi,

no it's not ok to change the owner all the way down.
What I would do is change chmod for directories to 775 and for files 664.
That should be a bit safer and will probably not break Plesk and its functions the way you might be breaking it doing it your way.

Regards,
Kristian
 
Hey, Kristian,

You was right. Changing owners all the way down broke my sites, so I revert the owners and set 775 and 664 as you told me. It works like a charm! Thank you so much! I appreciate it!

Regards,
Ned
 
Back
Top