You have written a script using the php script and need to run it regularly in crontab, but the following error occurs:
The code is 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 line 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 solution 1 add the following code
Code
The code is 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)
...............
Operation failed
Try solution 2 Add the following code
The code is as follows:
$ Cur_dir = dirname (_ FILE __);
Chdir ($ cur_dir );
Require (../class/a. php)
Require (../class/B. php)
Running successful
Summary: If you run the php script in crontab in the relative directory of require, you must enter the directory where the script is located.