Monday, March 10, 2014

Warning: require_once() [function.require-once]: SAFE MODE Restriction in effect.

After migration to new server Linux-Php on share hosting following error occur

Warning: require_once() [function.require-once]: SAFE MODE Restriction in effect. The script whose uid is 1438 is not allowed to access /usr/lib/php/PEAR.php owned by uid 0 in /home/yourdomain/php/DB.php on line 30

Warning: require_once(/usr/lib/php/PEAR.php) [function.require-once]: failed to open stream: No such file or directory in /home/yourdomain/php/DB.php on line 30

Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/yourdomain/php/DB.php on line 30

Resolve it by adding Include path in your php script....

some server not support
require_once( "/home/yourdomain/php/DB.php" );

It should be...
$path = '/home/yourdomain/php/';
set_include_path($path . PATH_SEPARATOR . get_include_path());
require_once( "DB.php" );

No comments: