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

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/ on line 0
PHP Notice:  Undefined index: REQUEST_URI in /var/www/ on line 0
PHP Warning:  WURFL_ClassLoader::loadClass(/var/www/ failed to open stream: No such file or directory in /var/www/ on line 0
PHP Warning:  WURFL_ClassLoader::loadClass(/var/www/ failed to open stream: No such file or directory in /var/www/ on line 0
PHP Warning:  WURFL_ClassLoader::loadClass(): Failed opening '/var/www/' for inclusion (include_path='.:/usr/share/php') in /var/www/ on line 0
PHP Fatal error:  Class 'WURFL_Configuration_InMemoryConfig' not found in /var/www/ on line 0


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 ?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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 –2017-09-14 15:12:42-- Resolving (… ::ffff:, 79 Connecting to (|::ffff:|: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.

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.