Search code examples
phpwordpressnginxhttp-status-code-500

Wordpress http 500 error on install


I know there are a lot of posts about this, but most of them seem to be much later on in the life of a wordpress site - mine is happening on the install.php, so I'm guessing its a more fundamenal issue.

My setup:

Windows 10 (1803)
Nginx (1.15.2)
PHP (7.2.9 - None Thread Safe)
MySQL (8.0 - Community)

The file structure - (in case it has any baring is)

nginx - \Development\nginx\nginx-1.15.2\
PHP   - \Development\php\php-7.2.9-nts-Win32-VC15-x64\

nginx is serving files from its /html/ directory, with wordpressin a sub-directory html/wordpress

MySQL has a blank database called "wordpress" created, and is accessible via the command line, and the HeidiSQL application using the credentials for the wordpress site.

I know that php is working as a basic <?php phpinfo(); ?> file outputs the PHP info, and accessing http://127.0.0.1:8080/wordpress/wp-admin/setup-config.php starts the install proces with the screen requesting database info. However submitting this goes to:

http://127.0.0.1:8080/wordpress/wp-admin/setup-config.php?step=2

Which throws the 500 error, blank white screen.

In the nginx access log I can see this:

127.0.0.1 - - [28/Aug/2018:08:56:20 +0100] "POST /wordpress/wp-admin/setup-config.php?step=2 HTTP/1.1" 500 5 "http://127.0.0.1:8080/wordpress/wp-admin/setup-config.php?step=1&language=en_GB" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"

But there is nothing in the nginx error log - literally nothing, it was filled with missing favicon lines but i created a blank one to reduce the noise from that.

When wp-config.php is hard coded with the database info and the line define('WP_DEBUG', true);, accessing install.php gives the error 500 error - but no additional information.

Any idea what the issue is? Could it be a file permissions issue, I'm assuming nginx is running as my windows user - which is an administrator.

UPDATE:

Windows php doesn't come with an php.ini file (why!!!) so I crabbed one from http://www.reallylinux.com/docs/php.ini and placed it int eh php root directory - this worked and i could switch on erro logging

This now gives me somethign to work on - as I'e got to the route of the issue:

[error] 2200#6728: *9 FastCGI sent in stderr: "PHP Fatal error:  
UncaughtError: Call to undefined function mysql_connect() in \nginx\nginx-1.15.2\html\wordpress\wp-includes\wp-db.php:1564

Any one know why mysql_connect() is undefined?

UPDATE 2:

The actual route cause of the issue was this PHP bug:

Cannot connect to mysql 8 using Php 7.2.8 (https://bugs.php.net/bug.php?id=76660)

Downgrading to PHP 7.2.7 and the issue went away... given the changes made in the accepted answer.


Solution

  • mysql_connect() is a function that was there till PHP 5.2, and was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. Ref: PHP Manual