Are PHP scripts run using the "php" command affected by the timeout limit? I plan to schedule php scripts using cron.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Some systems, such as Ubuntu, actually already start with separate CLI and Apache configurations in
/etc/php5
.The relevant command in the ini file is:
However, if you are unable to modify the php.ini for whatever reason, you can create a new php.ini with configuration settings favourable to the command-line, and point to the file like so:
php -c /path/to/ini/php.ini -f script.php
Or, you can use Cailin's solution, and set the time limit at the top of the file - but if you are running on a server with PHP 'safe mode' enabled, then you will have to use your own ini file.
Yes, but you can set an unlimited timeout by adding this to the top of your script:
Depends. If your php binary is the PHP CLI interface, the default
max_execution_time
is zero (meaning there is no limit).On the other hand, if it's the older-style CGI binary, you will be affected by the
max_execution_time
limit, and you'll need to callset_time_limit
to get rid of it (assuming you're not in the dreaded PHP safe mode).