tags:

views:

176

answers:

4

I'm debugging some PHP code written by an outsourcing company (I'm not a PHP guy at all but know the basics; we have an offshore team of PHP developers working for us on this project) that's not working; the code is supposed to be called every 30 minutes by a cron job but its not firing. I tried to run the PHP script via the command line to test if it's working, but it's giving me the following (anonymized) errror:

PHP Fatal error: require_once(): Failed opening required '/myapp/_lib/_classes/MySql.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/myapp/_lib/_base/common.inc.php on line 6

However, the file /var/www/html/myapp/_lib/_classes/MySql.php exists under the proper directory. I'm missing something simple, I'm sure, but like I said I know really nothing beyond the bare basics of PHP and I really need to get this service up and running.

EDIT: The code is using the __autoload() function with all classes in /_lib/_classes

A: 

Case sensitivity maybe? I've had that problem before.

Meep3D
A: 

I'm guessing it's a permissions issue - make sure both your account (for testing purposes) and whatever account cron is going to run your script under (quite possibly yours, but maybe a different one) have read privileges on the file.

Also: the path for the include says /myapp/_lib/_classes/MySql.php, whereas it exists in /var/www/html/myapp/_lib/_classes/MySql.php. Can you change the include to reference the full path?

Dathan
+2  A: 

if you start a file name with a slash, it means it's an absolute path. try instead:

require_once('/var/www/html/myapp/_lib/_classes/MySql.php');
SilentGhost
A: 

As said, casing and in addition the correct permissions to access that file are needed.

DaDaDom
The casing is right, however, and full permissions are granted on the file. I just found the code is using the __autoload function to load code dynamically.
Wayne M