• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Is Plesk changing the linux permissions?

R

rfuguet

Guest
Hi!

I'm migrating a website made in PHP to Plesk, and I have some troubles with permissions. Is it possible that Plesk overide the permissions that I put in console? I turned out the safe_mode, but i'm not sure if this is enough.

The file test_server.php:

<?php
echo "Test message";
?>

is in /var/www/vhosts/domain1/httpdocs/path1/test_server.php
and its permissions are: 775 user1 group1

The file test_include.php:

<?php
echo "Starting";
require_once("/var/www/vhosts/domain1/httpdocs/path1/test_server.php");
?>

is in /var/www/vhosts/domain2/httpdocs/path2/test_include.php
and its permissions are: 775 user1 group1

When I execute test_include.php in a browser, I can see "Starting", but not "test message".

When I move test_server.php to the same domain of test_include.php (/var/www/vhosts/domain2/httpdocs/path1/test_server.php) it works.

When I enter by terminal, (user1@domain2) I can access the file without problems when I type:
vi "/var/www/vhosts/domain1/httpdocs/path1/test_server.php"
(user1 is not root)

Finally, some folders in httpdocs have the 755 permissions, but when I type in a browser return "403 Forbidden".

I have read Plesk documentation, and searched centos permissions, but now I'm stuck.

Some clue?

Thanks!
 
Plesk uses PHP's open_basedir setting to restrict PHP scripts to their domain's httpdocs directory (and /tmp) for security. If you check the domain's error_log you'll see that the open_basedir restriction is in effect (or enable display_errors to see errors in your browser, but this is not recommended for production sites).

You can override a domain's open_basedir setting if you want, for instance you can add domain2's path2 directory to domain1's open_basedir like this:

Code:
<Directory /var/www/vhosts/domain1/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain1/httpdocs:/tmp:/var/www/vhosts/domain2/httpdocs/path2"
</Directory>

See Including Directives into Web Server Configuration File for instructions on adding custom Apache settings for a domain.
 
Back
Top