WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#33261 closed defect (bug) (fixed)

Random php error

Reported by: OKN Owned by: pento
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.2.3
Component: Database Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Hi

We have a random issue (Server Error 500) with wordpress 4.2.3 and 4.2.4.
We don't know why this error is provocated. We thing that the error is related with a wordpress database connection and mysqlnd extension or unknown issue.

Please, could you provide us with any solution (configuration or patch...)

INFO:
Ubuntu 14.04.2 LTS Server 64bits
Apache/2.4.7 (Ubuntu)
php5-fpm PHP Version => 5.5.9-1ubuntu4.11
PHP Mod Extension for mysql= mysqlnd 5.0.11 + mysqlnd_ms 1.5.2 (API Extensions mysql,mysqli,pdo_mysql), Opcache (enabled and disabled tested)
mysql Ver 14.14 Distrib 5.5.44, for debian-linux-gnu (x86_64) using readline 6.3
Wordpress: 4.2.3 and 4.2.4 (md5 sum is ok) Plugins (none) Theme (Default)

apache error.log

[Tue Aug 04 12:40:29.658117 2015] [fastcgi:error] [pid 16895:tid 140665899882240] (104)Connection reset by peer: [client MYCLIENTIP:35852] FastCGI: comm with server "/usr/local/fastcgi/php5.fastcgi" aborted: read failed, referer: http://MYDOMAINNAME/wp-admin/
[Tue Aug 04 12:40:29.658179 2015] [core:error] [pid 16895:tid 140665899882240] [client MYCLIENTIP:35852] AH00524: Handler for fastcgi-script returned invalid result code 1, referer: http://MYDOMAINNAME/wp-admin/
[Tue Aug 04 12:40:29.905614 2015] [fastcgi:error] [pid 16880:tid 140665925060352] (104)Connection reset by peer: [client MYCLIENTIP:35854] FastCGI: comm with server "/usr/local/fastcgi/php5.fastcgi" aborted: read failed, referer: http://MYDOMAINNAME/wp-admin/plugins.php
[Tue Aug 04 12:40:29.905674 2015] [core:error] [pid 16880:tid 140665925060352] [client MYCLIENTIP:35854] AH00524: Handler for fastcgi-script returned invalid result code 1, referer: http://MYDOMAINNAME/wp-admin/plugins.php
[Tue Aug 04 12:40:31.863521 2015] [fastcgi:error] [pid 16883:tid 140665773991680] (104)Connection reset by peer: [client MYCLIENTIP:35853] FastCGI: comm with server "/usr/local/fastcgi/php5.fastcgi" aborted: read failed, referer: http://MYDOMAINNAME/wp-admin/
[Tue Aug 04 12:40:31.863569 2015] [core:error] [pid 16883:tid 140665773991680] [client MYCLIENTIP:35853] AH00524: Handler for fastcgi-script returned invalid result code 1, referer: http://MYDOMAINNAME/wp-admin/

/wp-content/debug.log

PHP Deprecated:  mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /www/wordpress-4.2.3/wp-includes/wp-db.php on line 1473

[04-Aug-2015 12:30:16 UTC] PHP Stack trace:
[04-Aug-2015 12:30:16 UTC] PHP   1. {main}() /www/wordpress-4.2.3/index.php:0
[04-Aug-2015 12:30:16 UTC] PHP   2. require() /www/wordpress-4.2.3/index.php:17
[04-Aug-2015 12:30:16 UTC] PHP   3. require_once() /www/wordpress-4.2.3/wp-blog-header.php:12
[04-Aug-2015 12:30:16 UTC] PHP   4. require_once() /www/wordpress-4.2.3/wp-load.php:37
[04-Aug-2015 12:30:16 UTC] PHP   5. require_once() /www/wordpress-4.2.3/wp-config.php:84
[04-Aug-2015 12:30:16 UTC] PHP   6. require_wp_db() /www/wordpress-4.2.3/wp-settings.php:79
[04-Aug-2015 12:30:16 UTC] PHP   7. wpdb->__construct() /www/wordpress-4.2.3/wp-includes/load.php:352
[04-Aug-2015 12:30:16 UTC] PHP   8. wpdb->db_connect() /www/wordpress-4.2.3/wp-includes/wp-db.php:647
[04-Aug-2015 12:30:16 UTC] PHP   9. mysqli_real_connect() /www/wordpress-4.2.3/wp-includes/wp-db.php:1443
[04-Aug-2015 12:30:50 UTC] PHP Warning:  mysqli_real_connect(): (mysqlnd_ms) (mysqlnd_ms) Failed to parse config file [/etc/php5/PHPMYSQLBALANCER.ini]. Please, verify the JSON in /www/wordpress-4.2.3/wp-includes/wp-db.php on line 1443

[04-Aug-2015 12:30:50 UTC] PHP Stack trace:
[04-Aug-2015 12:30:50 UTC] PHP   1. {main}() /www/wordpress-4.2.3/index.php:0
[04-Aug-2015 12:30:50 UTC] PHP   2. require() /www/wordpress-4.2.3/index.php:17
[04-Aug-2015 12:30:50 UTC] PHP   3. require_once() /www/wordpress-4.2.3/wp-blog-header.php:12
[04-Aug-2015 12:30:50 UTC] PHP   4. require_once() /www/wordpress-4.2.3/wp-load.php:37
[04-Aug-2015 12:30:50 UTC] PHP   5. require_once() /www/wordpress-4.2.3/wp-config.php:84
[04-Aug-2015 12:30:50 UTC] PHP   6. require_wp_db() /www/wordpress-4.2.3/wp-settings.php:79
[04-Aug-2015 12:30:50 UTC] PHP   7. wpdb->__construct() /www/wordpress-4.2.3/wp-includes/load.php:352
[04-Aug-2015 12:30:50 UTC] PHP   8. wpdb->db_connect() /www/wordpress-4.2.3/wp-includes/wp-db.php:647
[04-Aug-2015 12:30:50 UTC] PHP   9. mysqli_real_connect() /www/wordpress-4.2.3/wp-includes/wp-db.php:1443

Change History (8)

#1 @johnbillion
5 years ago

  • Component changed from General to Database
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi OKN,

The errors you're seeing in your Apache error log are due to a problem with FastCGI on your server. You will need to contact your web host and report this issue to them.

The errors listed in wp-content/debug.log are just informational messages which state that the mysql extension in use on your site is deprecated. You should ask your host if you can switch to mysqli which is the modern alternative.

I'll close this ticket off as neither of these are core WordPress issues, rather they're sever configuration errors. If you need any more help, you can try posting on the WordPress support forums.

#2 @OKN
5 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Sorry but I am the web hosting cloud infrastructure.

I have more web sites in the same host and only with WordPress we have this random Issues. We use mysqlnd and mysqlnd_ms ("nd" is php Native Driver... deprecated?) thats not deprecated is the native driver for mysql of php 5.5 and supports mysql, mysqli and pdo_mysql drivers.

The funtions used in wordpress code are deprecated, the errorrs are caused for wordpress not for my PHP 5.5 and mysql driver....

The fast-cgi is correct. We have more than 100 web sites with thousands users running and all run ok, only wordpress fail, why?

Last edited 5 years ago by OKN (previous) (diff)

#3 @SergeyBiryukov
5 years ago

  • Description modified (diff)
  • Milestone set to Awaiting Review

#4 @nexurium
5 years ago

In wp-includes/load.php at line 136 replace

if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {

by

if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {

#5 @nexurium
5 years ago

  • Keywords has-patch added

#6 @pento
5 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Owner set to pento
  • Status changed from reopened to accepted

#7 @pento
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36434:

Database: Allow loading when only the mysqlnd extension is loaded.

We do an early check for a mysql extension being loaded, but it fails if the mysqlnd extension is the only one present.

Props nexurium.

Fixes #33261.

#8 @nexurium
5 years ago

#35441 was marked as a duplicate.

Note: See TracTickets for help on using tickets.