Report this

What is the reason for this report?

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

Posted on September 13, 2017

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.