Crontab mit include

Malte1975

New Member
Hallo,

habe folgendes Problem

Ich rufe eine PHP datei mithilfe des Crontabs auf, klappt auch Wunderbar.
Bloss wenn ich jetzt aus der PHP datei eine weitere PHP datei include will, meckert Confixx, das er die Datei nicht findet. Wenn man allerdings alles manuell ausführt, klappt dieses wunderbar.

bsp. Pfad für den Crontab
/usr/bin/php /srv/www/htdocs/webxx/html/phpordner/script.php

bsp. include
include ("script2.php");
 
Moin

include ("script2.php");

Wenn du das so schreibst, wird die Datei in / gesucht und da ist sie nicht.
Entweder Pfad komplett ausschreiben oder einen "include-path" angeben.
Oder auch "./script2.php"
 
Relativ zum ausgeführten Script:
PHP:
$basepath=dirname(realpath(__FILE__))."/";
include($basepath."includes/file.inc.php");
 
Bekomme leider immer diese Fehlermeldung...
Code:
<b>Warning</b>: main(): open_basedir restriction in effect. File(/srv/www/htdocs/webxx/html/phpordner/Script2.php) is not within the allowed path(s): (/srv/www/htdocs/e/) in <b>/srv/www/htdocs/webxx/html/phpordner/Script2.php</b> on line <b>2</b><br />

<b>Warning</b>: main(/srv/www/htdocs/webxx/html/phpordner/Script2.php.php): failed to open stream: Operation not permitted in <b>/srv/www/htdocs/web190/html/phpordner/Script2.php</b> on line <b>2</b><br />
<br />
Habe diverse Pfadangaben ausprobiert z.B.
include ("/srv/www/htdocs/webxx/html/phpordner/Script2.php");
include ("srv/www/htdocs/webxx/html/phpordner/Script2.php");

$pfad = dirname(__FILE__);
include ("$pfad/Script2.php");
include ("/$pfad/Script2.php");

habe es auch mit dem Vorschlag von elias5000 und Guin probiert.

Irgendwie klappt das alles nicht...
 
Last edited by a moderator:
Hallo!
Bitte verwende folgende Begriffe in der Forensuche: open_basedir restriction in effect.

mfG
Thorsten
 
Back
Top