• 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

vhost.conf ignored when script run through ssh rather than browser?

R

rene verheij

Guest
Hi,

Just set up open_basedir through vhost.conf to allow the whole domain to have access to /usr/local/share/something/, /var/www/vhosts/domain.com/httpdocs/ and /tmp.

When I run my script www.domain.com/file.php through the browser it gets access to /usr/local/share/something/, just like I want it too.

But now I need to run something through SSH:
/usr/bin/php -q /var/www/vhosts/domain.com/httpdocs/some_folder/file.php

which gives an error telling me about a open_basedir restriction. In other words, if running a script through SSH the open_basedir settings of vhost.conf seem to have no effect.

When the script tries to access ../some_other_folder/ it gives an open_basedir restriction error "... some_other_folder is not within the allowed path(s): (/tmp)" ... which is the global open_basedir setting.

Any advice?

Tnx in advance!
 
Right, vhost.conf settings are actual only for access via webserver (apache) and haven't any effect when you run php via CLI. All actual settings for php command are stored in /etc/php.ini file
 
Ok, that makes sense then. Tnx!

And do you know if the cronjobs for a specific domain that I add in plesk would use the vhost.conf file?
 
And do you know if the cronjobs for a specific domain that I add in plesk would use the vhost.conf file?

Once again - vhost.conf is just Apache config file and it is actual only for Apache operation. I don't know how this config file can be used for cronjob tasks. It can be modified somehow by cronjob task for changing webhosting domain's parameters (Apache settings), but can't be used as parameter for some cronjob tasks. Maybe it can be used but I can't imagine how :)
 
Back
Top