Hi,

How can I run a php script as an cron job?

Perhaps, I have to compile a PHP CGI-Module?
But I dunno how to compile it.

Or is there another way for my problem?

bye

Ron

    You could compile PHP as a stand-alone program and use that from cron.

    However, I find it easier to have a secret and/or IP-protected URL (e.g. available for 127.0.0.1 only) which I then call using curl. curl is a nice command-line utility for calling/getting URLs.

    The good thing about the latter approach is that your PHP automatically gets all .htaccess/httpd.conf settings right (if you use such means for controlling PHP).

      The php CGI module is pretty easy to compile. If you are in a unix enviornment, just unpack the tarball (in the directory with the php .tar.gz type tar xvfz php-x.x.x.tar.gz) and then move to the newly created directory php-x.x.x (cd php-x.x.x).

      Now, once inside this directory, you need to type './configure ...' this will set up the build for your current platform. Next, simply type 'make' at the command line and hit enter. This will compile the sources. It will give you a message once complete. Now that we have that done, just type 'make install' and the binary will be copied (by default) to /usr/local/bin/php where you can use it in shell scripts. Hope that helps!

      Chris King

        whoops, don't type './configure ...' just type './configure' .. where the hell did those dots come from?

        DOH!

        Chris King

          When I need to do this I usually just write a Perl program. The syntaxes between the languages are pretty similar (depending on what your'e trying to do) so it shouldn't be too hard.

            Even small PHP projects often have include files which are used to improve code re-use. This principle is broken if you suddenly change the programming language.

              Hi Scoot

              i´am not good in perl. I have looked at a source that connect to a mysql db and create a file with the csv data.

              Are you so friendly to give me a hint?

              Ron

                Write a Reply...