利用WordPress开发者调试模式解决PHP500内部服务器错误
- 时间:2020-05-17 12:22:02
- 分类:网络文摘
- 阅读:90 次
今天更新wordpress时,后台出现PHP500内部服务器错误。虽然知道500错误是一种比较友好的显示错识,但由于之前没有任何除升级外的操作,所以并不清楚具体原因。这时可以使用WordPress开发者专用的调试模式来看看服务器的报错原因。操作如下:
一、使用FTP工具登陆wordpress安装目录,下载wp-config.php文件。
二、打开wp-config.php文件,找到如下代码:
- define('WP_DEBUG', false);
将其中的false更改为ture,然后在其下添加一行代码:
- ini_set('display_errors','Off');
保存后上传。
三、重新访问网站错误页面,WordPress将显示所有用于开发的提示,指出错误原因及出错文件和具体行数,据此修改即可。
四、问题解决后,不要忘了将更改过的wp-config.php文件恢复后重新上传。
顺便说下我的出错原因,供有同样问题的朋友参考。使用WordPress开发者专用的调试模式后报错如下:
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 935286 bytes)
该错误系指服务器内存溢出,大多是因主机内存设置过小造成的。我的问题可能是由于升级时使用了非本地IP,因连接速度过慢,造成内存无法加载,以致于出错。
解决方法:
一、在 wp-config.php 文件的 define('WPLANG', 'zh_CN'); 下一行添上:
- define('WP_MEMORY_LIMIT', '64M');
二、在WordPress安装目录下新建一个.htaccess文件(已存在就不用新建了),在文件内填上:
- php_value memory_limit 64M
三、如果你有修改 php.ini 文件的权限,可以查找 memory_limit 修改为
- memory_limit = 64M ;
以上三种方法,大家可任意选用测试,其中上述代码中的64M可根据主机配置更改为更大数值。
推荐阅读:Using CloudFlare Worker Serverless Technology to Deploy a Load B Algorithms to Compute the Math Power(a, n) in logarithm Complexi Multithreading Testing using Pythons’ Low Level _threading Algorithm to Count the Number of Substrings With Only 1s How to Find Root of N-Ary Tree using the Hash Set? How Many Blocks and Total Rewards for a Steem Witness in the Pas Compute the Maximum Score After Splitting a String A Simple HTML Entity Parser in C++ Dynamic Algorithm to Compute the Longest Common Subsequence Algorithms to Locate the Leftmost Column with at Least a One in
- 评论列表
-
- 添加评论