• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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