简体   繁体   English

如何更改 memory_limit 的 PHP 主值

[英]How to change PHP master value of memory_limit

I trying to change the php memory_limit master value but still cant make it.我试图更改 php memory_limit主值,但仍然无法做到。

in htaccess i put ' php_value memory_limit 1024M ', it's only change the local value ..在htaccess中我放了' php_value memory_limit 1024M ',它只是改变了本地值..

Any ideas to change the master value?有什么想法可以改变主值吗?

Update your php.ini file. 更新您的php.ini文件。 If you are on shared hosting without access to it, then your only option is to set it locally. 如果您在共享主机上而无法访问它,那么您唯一的选择是在本地设置它。

If you want to change the master value, you'll need to find the php.ini file located on the server. 如果要更改主值,则需要找到服务器上的php.ini文件。 Take a look at https://stackoverflow.com/a/2750582/254973 if you need help finding the file. 如果需要查找文件的帮助, 访问https://stackoverflow.com/a/2750582/254973

Simply edit the value within that php.ini file, and you should be good to go. 只需编辑该php.ini文件中的值,就可以了。 Maybe a restart of the webserver depending on it's configuration. 也许根据其配置重启网络服务器。

This will more than likely require elevated/root access on your hosting server. 这很可能需要对主机服务器进行提升/根访问。

Check the location of your php.ini file 检查您的php.ini文件的位置

php -i | php -i | grep php.ini grep php.ini

Configuration File (php.ini) Path => /usr/lib/lib Loaded Configuration File => /usr/lib/php.ini 配置文件(php.ini)路径=> / usr / lib / lib已加载的配置文件=> /usr/lib/php.ini

Something like this and edit the file with your favorite editor: notepad, vim, emacs, pico... 像这样,并使用您最喜欢的编辑器编辑文件:记事本,vim,emacs,pico ...

pico /usr/lib/php.ini pico /usr/lib/php.ini

Search and change memory limit and restart apache. 搜索并更改内存限制,然后重新启动apache。

将php ini memory_limit = 128M更改为所需

I was searching all over the system for this value, it seems it's stored in我在整个系统中搜索这个值,它似乎存储在

/etc/php/8.1/fpm/pool.d/www.conf

I tried to change the memory_limit in these files but didn't change anything:我试图更改这些文件中的 memory_limit 但没有更改任何内容:

/etc/php/8.1/apache2/php.ini
/etc/php/8.1/fpm/php.ini
/etc/php/8.1/cgi/php.ini
/etc/php/8.1/cli/php.ini

Don't forget to restart the php and webserver (nginx/apache etc.) service after editing.编辑后不要忘记重启 php 和 webserver(nginx/apache 等)服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM