PDA

View Full Version : PHP cron jobs broken (eg. phplist)


mst3kroqs
02-22-2008, 09:49 AM
BlueHost has apparently removed the cli version of php from many (if not all) of their nodes. This was (to me anyway) highly annoying, as all of the sites I support were broken as they 'upgraded' the nodes.

I utilize a cron job to invoke the 'process queue' command for phplist, and also any CMS or other script which requires a periodic execution of a schedule script will require this.

To find out what version of php is installed on your node, run php -v from a commandline, and look at what is displayed in parens after the version number.

For instance on my node, php -v yields:

PHP 5.2.5 (cgi-fcgi) (built: Jan 7 2008 14:20:05)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Note the version (cgi-fcgi).

This means that php scripts can no longer be executed from the commandline, and therefore instead you need to utilize a different methodology to run the script. This used to work:


/usr/bin/php -q /home/youracct/public_html/phplist/admin/index.php -p processqueue

.. not not any more. There are a few workarounds, but curl should do the trick. Try using the following commandline in your cron job (this should also work interactively from a shell). This example is given for phplist, however you get the general idea - we are using curl to retrieve/execute the script via httpd:


/usr/bin/curl 'http://www.yourdomain.com/phplist/admin/index.php?page=processqueue&login=YOURLOGIN&password=YOURPASSWORD'


The only downside associated with this workaround is that the script that you want to execute must exist in the public_html tree somewhere.

Anyway, this should work... at least, until they remove curl. ;^)

-m

lazynitwit
02-22-2008, 11:36 AM
$ which php
/usr/local/bin/php

$ /usr/local/bin/php -v
PHP 5.2.5 (cli) (built: Jan 7 2008 15:33:05)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies

On a side note, you can run the CGI/FCGI PHP interpreter from the command line. There are a few differences (http://php.net/features.commandline) (like headers being outputted, which can be disabled), but for the most part it should work.

bsapackman
03-02-2008, 09:05 AM
i have try all error any help??


/usr/bin/curl 'http://sitename.com/admin/index.phppage=processqueue&login=user&password=password'





/usr/bin/php /home/xxxx/public_html/sitename/admin/index.php -pprocessqueue -c/home/xxxxxxx/public_html/sitename/config/config.php >/dev/null




curl http://admin:password@www.sitename.com/admin/index.php


__________________________________________________ _____

send in the cron for ever hour sent
set the
config.php
batch 480 emails
every hour
every hour

this does not work i get a error mess from this my email and i sent

i have look on phplist information and on her noting i seen that will work

plan is
make an email then send them automatice sending them off durning the day untill there all sent off

-------------------------------------------------------------------------
site note
this email will have about a 1000"s in the frist few day when they go live .