# PHP and Crontab



## Zimbop (Apr 8, 2002)

I'm using PHP compiled by Marc Liyanage at http://www.entropy.ch/ (I think it's an Apache module). It works great in every respect, however, I would like to run .php files with cron and have tried using cronnix to do this but have had no luck.

I was using the shebang line #!/usr/bin/php which has worked on virtual web hosting accounts on linux in the past.

Now, there's no "php" in /usr/bin/php only "php-config" "phpextdist" "phpize" and "phptar".

So how do I execute "test.php". Is it possible with the apache module version of PHP or does it need to be the CGI version. And where is php, if in the terminal I go "whereis sendmail" I get "/usr/sbin/sendmail", but if I do "whereis php" I get nothing!

Regards

Zimbop


----------



## strikeman (Apr 9, 2002)

I compiled a standalone php executable into /usr/bin/, and my crontab uses that to run my php scripts.


----------



## elspif (Dec 2, 2002)

how do I compile a stand alone php executable?


----------



## Fahrvergnuugen (Dec 2, 2002)

you will either have to find the binary somewhere or compile it yourself...which can be a bit tricky. I havn't tried compiling php since 4.1 and then it was such a pita.


----------



## elspif (Dec 3, 2002)

I found a binary but don't know how to run it. The file is a .gz file but won't unzip or anything. If I just run it like it is it won't go. Any hints?

Found it at www.etropy.ch where the other tutorials are under the FAQ:

>Can I also get the CGI version of PHP?"
>Yes. Here is the binary (at version 4.1.1).

With a link to http://www2.entropy.ch/download/php-cgi-4.1.1.gz

I must be doing something dumb but please let me know what 

thx


----------



## Zimbop (Dec 3, 2002)

put it in your home directory and then open a terminal and type:

gunzip php-cgi-4.1.1.gz

That should unzip it.


----------



## elspif (Dec 4, 2002)

I did that but it tells me the file is not in gzip format. Are there other formats? Can i untar this or what? I tried most things even going into classic and using the old stuffit expander. Any tips are welcome. This is what Darwin tells me:

Welcome to Darwin!
[local:~] spif% ls
Desktop             Icon?               Public              jbproject
Documents           Library             SME                 php-cgi-4.1.1.gz
Downloads           Movies              Sites
Eleven              Music               Temp
Fonts               Pictures            To Print
[local:~] spif% gunzip php-cgi-4.1.1.gz

gunzip: php-cgi-4.1.1.gz: not in gzip format
[local:~] spif%


----------



## namaste (Dec 4, 2002)

One way to use cron with the module would be to put something like _curl http://someurl.com/myscript.php_ in your shell script. I've used this often to trigger php scripts on machines that are using php as a module on both apache and IIS.


----------



## Zimbop (Dec 4, 2002)

elspif, I have that binary installed and it works fine, although I downloaded it months ago. I'll try and download it and expand it again and let you know what happens.


----------



## Zimbop (Dec 4, 2002)

Try this one ...

http://www.digitalmediaart.com/php-cgi-4.1.1.gz

I could only expand it with Stuffit Expander 6.5.1, strangely neither the terminal (gunzip) or stuffit expander 7.0.1 would touch it, no idea why.

Let me know when you've grabbed it so I can remove it.


----------



## elspif (Dec 5, 2002)

thx zimbop.

I got the file will try this weekend to unstuff with 6.5.1. The urgency to get the binary working has been solved since the main reason I needed it was to install PEAR. But i found a different solution that solved everything first go.

For those of you looking for an easy way to install PEAR even if you have restricted acces on your webserver (because of hosting companies' restrictions) try this http://dickmann.homeunix.org/pear/go-pear.html

Thx for your help though zimbop, I might need the php binary in the future for other purposes.


----------



## Zimbop (Dec 5, 2002)

The version that I posted you should be able to use gunzip from the terminal. I recompressed it myself, no need to get 6.5.1


----------

