php怎么设置最大内存
2022-12-02 09:01:16
188
{{single.collect_count}}

php设置最大内存的方法:首先在php.ini里面设置“memory_limit = 128M;”;然后通过PHP的ini_set函数设置“ini_set('memory_limit', '128M');”即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

本文操作环境:Windows7系统、PHP7.1版,DELL G3电脑

PHP修改脚本最大执行时间和最大内存限制

  • PHP设置脚本最大执行时间的三种方法

在php.ini里面设置

max_execution_time = 120;
登录后复制

通过PHP的ini_set函数设置

ini_set("max_execution_time", "120");
登录后复制

通过set_time_limit 函数设置

set_time_limit(120);
登录后复制

以上几个数字设置为0则无限制,脚本会一直执行下去。

  • PHP设置脚本最大内存限制的三种方法

在php.ini里面设置

memory_limit = 128M ;
登录后复制

通过PHP的ini_set函数设置

ini_set('memory_limit', '128M');
登录后复制

修改Apache的 .htaccess文件

说明: 这种方法只有在php以Apache模块来执行时才生效.。

在你的网站的根目录下找到".htaccess"文件,如果没有,可以自己创建一个。

然后把以下配置放入其中:

php_value memory_limit 128M ;
登录后复制

推荐学习:《PHP视频教程

以上就是php怎么设置最大内存的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}