如何使用PHP运行Cron作业? [英] how can i run cron jobs with PHP?

查看:65
本文介绍了如何使用PHP运行Cron作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行ubuntu 10.04,并通过以下方式安装了php5:

I'm running ubuntu 10.04 and have installed php5 via the following:

sudo aptitude install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-pspell php5-snmp php5-sqlite php5-xmlrpc php5-xsl

在我的研究中,以下是如何将cron作为PHP运行的示例:

In my research, the following is an example of how to run cron as PHP:

00 * * * * /usr/bin/php /home/john/myscript.php

问题是...我正在查看我的/usr/bin/文件夹...,但没有看到任何PHP文件夹或符号链接...基本上/usr/bin/php不存在,我需要它来将我的PHP脚本作为cron作业运行.

the problem is... i'm looking in my /usr/bin/ folder... and I do NOT see any PHP folder or symlink... basically /usr/bin/php is non-existant and I need this to run my PHP scripts as cron jobs.

有人可以告诉我为什么(在成功安装php之后)"/usr/local/bin/php"不存在吗?我检查了多个在线资源,默认情况下应存在"/usr/bin/php".

can someone tell me why (after a successful php installation) "/usr/local/bin/php" does not exist? I have check multiple online sources and "/usr/bin/php" should exist by default.

请帮助!

推荐答案

cron语法基本上可以.

The cron syntax is basically ok.

尝试...

whereis php

...或...

whereis php5

...找到您的php bin文件夹所在的位置.

...to find where your php bin folder is located.

这篇关于如何使用PHP运行Cron作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆