Linux executes PHP scripts on a regular basis
Execute PHP Script
Method 1If you want to execute a PHP script on a regular basis, you can write it directly:*/1 * * * * * root-q/bin/local/php/path/to/your/php/script.php (script.php per minute)Note
Welcome to the Linux community forum and interact with 2 million technical staff to access the method for executing the php script with parameters under the command line: compile this executable file,
Welcome to the Linux community forum and
Php command line (cli) to execute the relative path of the PHP script file. Php command line (cli) to execute the relative path of the PHP script file. the working directory of the Execution Environment (getcwd () is the relative path of the php
Before proceeding, if you do not understand what GC (GarbageCollection) is, you must first understand GC. Otherwise, you do not know what I am talking about! Links: www. php. netmanualenfeatures. gc. phpblog. csdn.
[Switch] PHP scheduled tasks: how to use Linux Crontab to execute PHP scripts. Turn: www.centos.bz2 01103auto-run-task-crontab our PHP program sometimes needs timed execution, we can use the ignore_user_abort function or place js on the page for
Review
Linux crontab is the implementation of timed execution of instructions, using this command we can execute a certain PHP file at a time, so that the implementation of PHP as a Linux automatic script execution.
How to use PHP as a Linux
PHP features: the command line mode starts with version 4.3.0. PHP provides a new type of cli sapi (Server Application Programming Interface, Server Application Programming Port) support, named CLI, command Line Interface, that is, Command Line
Implementation of PHP script under Linux, Linux executes PHP script
Entering commands in Linux
Copy the Code code as follows:Crontab-e
Then use the VIM command to edit the open file, enter
Copy the Code code as follows:0 * * *
Recently in a community with PHP, writing to calculate the highest number of people, successfully debug the PHP as a shell script directly on the server run.
When making a community, it is often necessary to count data such as the number of people
first, use PHP to execute scripts in crontab
Just like calling a normal shell script in crontab (specifically crontab usage), use a PHP program to invoke the PHP script.The following myscript.php are performed every hour:
1
#
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.