PHP cli command line safe_mode restriction

馋奶兔 提交于 2019-12-06 03:13:04
ck_

At nowadays you can schedule php script execution from UI like this:

In case you still need execute script via command line pay attention that Plesk's PHP binaries are placed in:

# 7.0
/opt/plesk/php/7.0/bin/php
# 5.6
/opt/plesk/php/5.6/bin/php
# 5.5
/opt/plesk/php/5.5/bin/php
# and so on

Original answer:

I know this is a few months old, but for the next person that comes across a problem while using Plesk and cron and PHP, here's the answer.

While Plesk does run cron as ROOT, it also runs PHP by default with safe mode ON, which means that when you setup a cron in Plesk that needs PHP, it's going to have restrictions that you do not experience from the shell or from the web.

So what you do is use the CLI /etc/php.ini option override, like so:

/usr/bin/php -q -d safe_mode=Off /var/www/vhosts/path-to-your-php-file.php

Have you disabled safe_mode in the php.ini for CLI?

You can find the location of this file by running the following command php --ini. Search for safe_mode in this file and change the line to safe_mode = Off.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!