执行一个PHP脚本用cron作业 [英] Executing a PHP script with a CRON Job

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

问题描述

我想在每天午夜运行PHP脚本。如何做到这一点的研究后,看来实现这一目标的最佳途径是使用cron作业。

I would like to run a PHP script every day at midnight. After research on how to do this, it appears that the best way to achieve this is to use a CRON job.

如果我的PHP脚本位于<一个href=\"http://example.com/scripts/scriptExample.php\">http://example.com/scripts/scriptExample.php,可有人能够显示这是什么cron命令看起来像最简单的例子?

If my php script was located at http://example.com/scripts/scriptExample.php, can somebody be able to show the most simple example of what this CRON command would look like?

我已经通过无数的帖子看了,但我无法找到一个简单的例子足以让我学习和借鉴。

I have looked through numerous posts but I cannot find a simple enough example for me to learn and build upon.

由于提前,

推荐答案

crontab的需要的完整路径,您的服务器上。

Crontab needs the full path on your server.

0 0 * * * php /var/www/vhosts/domain.com/httpdocs/scripts/example.php

这将在午夜执行每一天。

This will execute every day at midnight.

这篇关于执行一个PHP脚本用cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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