Copy Code code as follows:
/var/www/html/bt/e/btsys:.:/ Usr/share/pear:/usr/share/phpphp Warning:require (.. /class/connect.php): Failed to open stream:no such file or directory in/var/www/html/bt/e/btsys/torrents-scrape.php on L INE 17
PHP Fatal Error:require (): Failed opening required '. /class/connect.php ' (include_path= '/var/www/html/bt/e/btsys:.:/ Usr/share/pear:/usr/share/php ') in/var/www/html/bt/e/btsys/torrents-scrape.php on line 17
Try resolving Method 1 by adding the following code
Code
Copy Code code as follows:
Setting include path
$cur _DIR=GETCWD ();
$cur _dir= $basedir = dirname (__file__);
$path = Ini_get (' include_path ');
Ini_set ("Include_path", "$cur _dir: $path");
$path = Ini_get (' include_path ');
echo $path;
Require (.. /class/a.php)
Require (.. /class/b.php)
...............
Run failed
Try resolving Method 2 by adding the following code
Copy Code code as follows:
$cur _dir = dirname (__file__);
ChDir ($cur _dir);
Require (.. /class/a.php)
Require (.. /class/b.php)
Run successfully
Summary: In require, if the relative directory, in the crontab run PHP script, to enter the script directory can