PHP命令行:max_execution_time和memory_limit [英] PHP command line: max_execution_time and memory_limit

查看:54
本文介绍了PHP命令行:max_execution_time和memory_limit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问.

如果我从命令行运行php脚本(通过cron作业"php ./somwthing-sync.php"),我是否仍受制于php max_execution_time和memory_limit?

谢谢

内森

解决方案

(如果您查看

Quick question.

If I run a php script from the command-line (through a cron job, "php ./somwthing-sync.php"), am I still bounded to the php max_execution_time and memory_limit?

Thanks

Nathan

解决方案

if you look at the doc , its says

      max_execution_time  integer

This sets the maximum time in seconds a script is allowed to run before it is 
terminated by the parser. This helps prevent poorly written scripts from 
tying up the server. The default setting is 30. 
When running PHP from the command line the default setting is 0.

A 0 means unlimited. (If i am not wrong). As for memory_limit, the PHP command line will take the value that is defined in php.ini. This you can easily test and find out by writing code that "eats" memory and setting memory_limit to -1 in php.ini

这篇关于PHP命令行:max_execution_time和memory_limit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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