Jump to content

PHP command line problems


lodlock

Recommended Posts

I am been using a script by Boonex for a while now and havn't had any troubles until I updated to openSuSE 10.3. Ever since then when a cron job'd:

/usr/bin/php -q /path_to/notifies.php

 

returns an error of:

PHP Notice:  Use of undefined constant BX_DIRECTORY_PATH_INC - assumed 'BX_DIRECTORY_PATH_INC' in /path_to/notifies.php on line 24

PHP Warning:  require_once(BX_DIRECTORY_PATH_INCdb.inc.php): failed to open stream: No such file or directory in /path_to/notifies.php on line 24

PHP Fatal error:  require_once(): Failed opening required 'BX_DIRECTORY_PATH_INCdb.inc.php' (include_path='.:/usr/share/php5:/usr/share/php5/PEAR') in /path_to/notifies.php on line 24

 

The specific lines that it is complaining about are:

require_once( '/path_to/header.inc.php' );
[b]require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' );[/b]

 

Now the BX_DIRECTORY_PATH_INC is declared in the header.inc.php file. So in such it appears that it isn't actually passing declarations from the first require_once.

 

My php -v returns:

PHP 5.2.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 22 2007 02:01:31)

Copyright © 1997-2007 The PHP Group

Zend Engine v2.2.0, Copyright © 1998-2007 Zend Technologies

 

Now i'm not sure if php used to be a cgi install but now is a cli, unfortunately I do not recall.

 

I am not sure if the php-cgi command runs is the same as if i compiled php as a cgi instead of cli but if i run:

/usr/bin/php-cgi -q /path_to/notifies.php 

it just returns the source code of the php file and doesn't actually do anything.

 

I have been searching the internet for a while now as to either this issue or varying version differences that might have caused this issue but to no avail.

 

Any assistance in this matter would be greatly appreciated,

 

-Lodlock

Link to comment
Share on other sites

Also, because your calling this script via cron it executes from the same directory as cron. I'm not sure if you are already or not but your call to require_once needs a full path to the script. A relative path will not work from cron.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.