判断对错:一个阿帕奇错误或一个PHP错误和一个WordPress错误是一样的吗?

时间:2016-04-15 作者:LJones

我正在使用CentOS 6;Apache 2.2.2;MySQL 5.6;PHP 5.5.31;WordPress 3.8.13。我没有此服务器的root访问权限,因为它是共享的。我有FTP和SSH(对功能有一些限制)。

在将一家机构的自定义Facebook像素添加到头文件后的最后3天内,我遇到了持续的内存过剩问题,导致网站显示Fatal Error: Out of Memory. 它可能与代码片段没有任何关系,只是碰巧发生在几乎同一时间。为了缓解这个问题,我增加了PHP。ini从100米到400米,以支持功能并增加观众。我仍然遇到内存不足的错误,但至少它没有显示在网站上(据我所知)。

错误日志显示:

[Fri Apr 15 11:56:23 2016] [error] [client 00.001.001.001] out of memory
[Fri Apr 15 11:56:23 2016] [error] [client 00.001.001.001] Premature end of script headers: php-latest
[Fri Apr 15 11:56:38 2016] [error] [client 00.001.001.002] client denied by server configuration: /home/79930/domains/domain.com/html/xmlrpc.php, referer: http://domain.careers.com/index.cfm?fuseaction=512576.viewjobdetail&CID=512576&JID=529884
[Fri Apr 15 11:57:56 2016] [error] [client 00.001.001.003] (12)Cannot allocate memory: couldn\'t spawn child process: /etc/apache2/gs-bin/php-latest, referer: http://domain.com/careers/
[Fri Apr 15 11:57:56 2016] [error] [client 00.001.001.004] unable to init Zlib: deflateInit2 returned -4: URL /gs-bin/php-latest/index.php, referer: http://domain.com/careers/
[Fri Apr 15 11:58:34 2016] [error] [client 00.001.001.005] Out of memory, referer: http://domain.com/locations/eldersburg-commons/
[Fri Apr 15 11:58:39 2016] [error] [client 00.001.001.005] unable to init Zlib: deflateInit2 returned -4: URL /gs-bin/php-latest/index.php, referer: http://domain.com/locations/eldersburg-commons/
[Fri Apr 15 11:58:43 2016] [error] [client 00.001.001.005] Premature end of script headers: php-latest, referer: http://domain.com/locations/eldersburg-commons/
每小时可能有一个错误。仍然需要修复它。接下来,我查看了PHP错误日志,它显示了:

PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method wf_gmp::init() should not be called statically in /mnt/12345/domains/domain.com/html/wp-includes/plugin.php on line 429
PHP Strict Standards:  Non-static method wf_gmp::add_shortcodes() should not be called statically in /mnt/12345/domains/domain.com/html/wp-content/plugins/5sec-google-maps-pro/5sec-gmaps-pro.php on line 74
PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method wf_gmp::enqueue_scripts() should not be called statically in /mnt/12345/domains/domain.com/html/wp-includes/plugin.php on line 429
PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method wf_gmp::wp_print_styles() should not be called statically in /mnt/12345/domains/domain.com/html/wp-includes/plugin.php on line 429
PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method wf_gmp::init() should not be called statically in /mnt/12345/domains/domain.com/html/wp-includes/plugin.php on line 429
这些都是小错误。最后一步是我启用了WP Debug,它没有显示任何错误。下面的示例代码:

// Enable WP_DEBUG mode
define( \'WP_DEBUG\', true );
// Enable Debug logging to the /wp-content/debug.log file
define( \'WP_DEBUG_LOG\', true );
// Disable display of errors and warnings
define( \'WP_DEBUG_DISPLAY\', true );
@ini_set( \'display_errors\', 0 );
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define(\'SCRIPT_DEBUG\', true);
if (WP_DEBUG) ini_set(\'display_errors\',1);
所以,要么1。Apache或PHP错误(不一定)是WordPress错误。或者我的调试模式似乎被打破了。但我以前在这个网站上用过。

Bonus points for:
如何修复内存错误
您在使用Facebook Pixel时遇到过任何问题吗?

1 个回复
SO网友:Mark Kaplun

Wordpress错误是应用程序级错误。PHP错误是语言语法或使用错误,appach错误是在web服务器操作期间检测到的错误。

错误,尤其是较小的错误,可能会“向上”报告,看起来像wordpress应用程序错误,或者向下记录,如果应用程序需要,可以作为apache服务器错误日志的一部分。归根结底,当报告的内容不太相关时,错误本身才是重要的。

Bonus: 只有在1-100的范围内,代码吸吮度为1000时,FB像素才会导致内存问题。内存错误通常表示代码错误。“添加”内存只是隐藏了问题。您需要检查您的代码,了解导致它的原因,并解决它。