PHP errors while running script from command line ... (cron job)

September 13, 2017 90 views
PHP Nginx Ubuntu 16.04

Hi all,

I am running into these errors when trying to execute a cron job (both from the command line or from a cron tab) :

PHP Notice:  Undefined index: SERVER_NAME in /var/www/forwardial.com/htdocs/lib/app.inc on line 0
PHP Notice:  Undefined index: REQUEST_URI in /var/www/forwardial.com/htdocs/lib/app.inc on line 0
PHP Warning:  WURFL_ClassLoader::loadClass(/var/www/forwardial.com/htdocs/WURFL/Configuration/InMemoryConfig.php): failed to open stream: No such file or directory in /var/www/forwardial.com/htdocs/WURFL/ClassLoader.php on line 0
PHP Warning:  WURFL_ClassLoader::loadClass(/var/www/forwardial.com/htdocs/WURFL/Configuration/InMemoryConfig.php): failed to open stream: No such file or directory in /var/www/forwardial.com/htdocs/WURFL/ClassLoader.php on line 0
PHP Warning:  WURFL_ClassLoader::loadClass(): Failed opening '/var/www/forwardial.com/htdocs/WURFL/Configuration/InMemoryConfig.php' for inclusion (include_path='.:/usr/share/php') in /var/www/forwardial.com/htdocs/WURFL/ClassLoader.php on line 0
PHP Fatal error:  Class 'WURFL_Configuration_InMemoryConfig' not found in /var/www/forwardial.com/htdocs/WURFLres/wurfl_config_standard.php on line 0

code

What I am doing is this from the command line : php5.6 cron-wurfl.php

The .php file is ioncube encoded, so I cannot go in there and edit it or something, however ioncube loaders are working properly and I can log in to the script which is encoded as well. I have received notice from the seller that the license is good, so I don't see why the cron job throws these errors. * I've also done this before on a differnt server and then it worked.

Anyone know what I am missing here ?

Lex

2 Answers

It looks like the php script was written to be run by a webserver, not from a cron job. The script is failing because environment variables that the webserver would set for it have not been set when running as a standalone script.

Not sure what you want the script to do, but you might be able to write another script that will make a request to your webserver to get the job done.

Tried running it through a wget command .... (that should be a webserver) ... also tried creating a cron tab for user www-data .... doesn't work either.....

The wget gives me this :

wget http://forwardial.com/cron-wurfl.php
--2017-09-14 15:12:42-- http://forwardial.com/cron-wurfl.php
Resolving forwardial.com (forwardial.com)... ::ffff:188.166.60.179, 188.166.60.1 79
Connecting to forwardial.com (forwardial.com)|::ffff:188.166.60.179|:80... conne cted.
HTTP request sent, awaiting response... 500 Internal Server Error
2017-09-14 15:12:43 ERROR 500: Internal Server Error.

Honestly, the cron-wurfl.php is encoded by ioncube ... and I just think the script sucks.... can't think of anything else.

Have another answer? Share your knowledge.