我在XAMPP版本3.2.2上有一个使用PHP 7的软件项目
问题在于Apache不断停止运行
我尝试将其放在 httpd.conf 文件中,但问题仍然存在
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>
错误日志显示如下:
[Fri Jun 07 15:57:50.687867 2019] [php7:error] [pid 4924:tid 1620] [client 172.16.5.211:57554] PHP Fatal error: Out of memory (allocated 4194304) (tried to allocate 4096 bytes) in C:\\xampp\\apps\\moodle\\htdocs\\lib\\navigationlib.php on line 3297
[Fri Jun 07 15:57:55.140977 2019] [mpm_winnt:crit] [pid 4924:tid 472] AH02538: Child: Parent process exited abruptly. Child process is ending
[Fri Jun 07 15:57:58.922259 2019] [core:warn] [pid 872:tid 436] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jun 07 15:57:59.000372 2019] [mpm_winnt:notice] [pid 872:tid 436] AH00455: Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1 configured -- resuming normal operations
[Fri Jun 07 15:57:59.000372 2019] [mpm_winnt:notice] [pid 872:tid 436] AH00456: Apache Lounge VC15 Server built: Nov 3 2017 10:30:36
[Fri Jun 07 15:57:59.000372 2019] [core:notice] [pid 872:tid 436] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Jun 07 15:57:59.000372 2019] [mpm_winnt:notice] [pid 872:tid 436] AH00418: Parent: Created child process 1872
[Fri Jun 07 15:57:59.719114 2019] [mpm_winnt:notice] [pid 1872:tid 460] AH00354: Child: Starting 150 worker threads.
感谢您的帮助
答案 0 :(得分:0)
您可以运行以下命令:memory_get_usage
返回分配给PHP的内存量。 (https://www.php.net/manual/en/function.memory-get-usage.php)
这:memory_get_peak_usage
返回PHP分配的内存峰值。 (https://www.php.net/manual/en/function.memory-get-peak-usage.php)
然后调整ini_set('memory_limit', '16M');
(在示例中为1600万,请根据先前命令获得的结果进行适当设置)。
以下是ini_set的文档:https://www.php.net/manual/en/function.ini-set.php
您也可以在这里找到有趣的提示: Fatal error: Out of memory, but I do have plenty of memory (PHP)
如果要编辑 php.ini :memory_limit
用于配置允许脚本分配的最大内存量(以字节为单位)。 (https://www.php.net/manual/en/ini.core.php#ini.memory-limit)