Lucy Weatherford
Lucy Weatherford

Reputation: 5534

PHP Cron Problems - using plesk: dynamic library, open_basedir

I entered the following command through plesk (control panel) crontab, to run a php file once an hour:

php httpdocs/cron/script.php

And I am getting the following 2 error messages (once an hour, to my email):

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/http.so' -
/usr/lib/php/modules/http.so: cannot open shared object file: No such file or directory in
Unknown on line 0
PHP Warning:  require_once(): open_basedir restriction in effect.
File(../include/functions.php) is not within the allowed path(s):
(/var/www/vhosts/basedomain.com:/tmp) in /var/www/vhosts/example.com/httpdocs/cron/script.php
on line 2
PHP Warning:  require_once(../include/functions.php): failed to open stream: Operation not
permitted in /var/www/vhosts/example.com/httpdocs/cron/script.php on line 2
PHP Fatal error:  require_once(): Failed opening required '../include/functions.php'
(include_path='.:') in /var/www/vhosts/example.com/httpdocs/cron/script.php on line 2

Note: Line 2 has require_once(../include/functions.php);

I realized these are 2 different issues. I tried solving each separately and they are both still with me. Any help would be appreciated. Thanks

Upvotes: 0

Views: 1660

Answers (2)

user1233508
user1233508

Reputation:

When you run PHP like this, configuration set in Plesk-specific and Apache-specific places like vhost.conf doesn't apply.

Since your script is already inside httpdocs, why don't you just use wget/curl to invoke the script through HTTP? Something like /usr/bin/curl http://yoursite.com/cron/script.php 2>&1. Might want to consider some additional validation (IP limiting, htpasswd auth) to make sure random visitors (script kiddies) can't run it.

Upvotes: 1

Milap
Milap

Reputation: 7221

Please check below, maybe it will help you.
http://www.geeklog.net/forum/viewtopic.php?showtopic=28107

Upvotes: 1

Related Questions