Database problem when updating PHP from 5.4 to 5.5

Having trouble installing serendipity?
schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Fri Jun 24, 2016 12:06 pm

Hi,

I'm currently running s9y 2.0.3 with PHP 5.4.45 on a 1&1 Managed Server, which works perfectly fine. However, when I try to change the PHP version to 5.5 I suddenly get the following error:
serendipity error: unable to connect to database - exiting.
Changing back to PHP 5.4 makes the blog working again. I checked the phpinfo() and can only see the following difference:

PHP 5.4 (working):
'--with-mysqli=/usr/bin/mysql_config' '--with-mysql=/usr' '--with-pdo-mysql'
PHP 5.5 (not working):
'--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql=mysqlnd' '--enable-opcache'
Any suggestions how to solve this? Do you need any more information?

Thanks in advance!
Flo

MarioH
Regular
Posts: 228
Joined: Mon Jul 20, 2009 10:53 pm
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by MarioH » Sat Jun 25, 2016 4:20 pm

This could be a problem with the stored password for your database. mysqlnd doesn't connect to databases with old insecure stored password hashes.

So it may help to reset the password with a tool like phpmyadmin. You can use your old password again, it will be stored with new secure hashes.

Regards
Mario

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Sat Jun 25, 2016 5:51 pm

Thanks for your feedback. Unfortunately that didn't solve the problem. However, I found a hint on the 1&1 website, which states that MySQL is no longer supported by PHP 5.5. Instead users should use the following code for MySQLi.
mysqli.php
<?php
$host_name = "localhost";
$database = "db480577850";
$user_name = "dbo480577850";
$password = "<Geben Sie hier Ihr Passwort ein. >";

$socket = "/tmp/mysql5.sock";

$connect = mysqli_connect($host_name, $user_name, $password, $database, NULL, $socket);

if(mysqli_connect_errno())
{
echo '<p>Verbindung zum MySQL Server fehlgeschlagen: '.mysqli_connect_error().'</p>';
}
else
{
echo '<p>Verbindung zum MySQL Server erfolgreich aufgebaut.</p>';
}
?>

mysql.php
<?php
$host_name = "localhost:/tmp/mysql5.sock";
$database = "db480577850";
$user_name = "dbo480577850";
$password = "<Geben Sie hier Ihr Passwort ein. >";

$connect = mysql_connect($host_name, $user_name, $password);
if(mysql_errno())
{
echo '<p>Verbindung zum MySQL Server fehlgeschlagen: '.mysql_error().'</p>';
}
else
{
echo '<p>Verbindung zum MySQL Server erfolgreich aufgebaut.</p>';
}

mysql_select_db($database);
?>
I realize the difference in the $host_name variable which is complemented by a new $socket variable in the mySQLi code. Howerver, I have no idea how to add this to the s9y configuration.

Any ideas?

MarioH
Regular
Posts: 228
Joined: Mon Jul 20, 2009 10:53 pm
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by MarioH » Sat Jun 25, 2016 6:01 pm

Hi,

in Settings - Configuration you can change the database type to MSQLi. Maybe that helps.

Regards
Mario

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Sat Jun 25, 2016 6:02 pm

Sorry I forgot to mention that. I already tried it but that also did not do the trick. I needed to change the serendipity_config_local.inc.php afterwards via FTP to get the blog working again.

MarioH
Regular
Posts: 228
Joined: Mon Jul 20, 2009 10:53 pm
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by MarioH » Sat Jun 25, 2016 6:35 pm

What is your MYSQL Version?

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Sat Jun 25, 2016 8:19 pm

I'm using MySQL 5.1.73-1+deb6u1

User avatar
garvinhicking
Core Developer
Posts: 30015
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by garvinhicking » Mon Jul 11, 2016 12:19 pm

Hi!

Edit your serendipity_config_local.inc.php and set:

Code: Select all

$serendipity['dbType']            = 'mysqli';
I'm wondering though that we should have an internal code that automatically uses mysqli when mysql is not available, and why that's not working in your case...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Mon Jul 11, 2016 12:32 pm

Hi Garvin,

thanks for your reply. I had already tried that but to no avail. Setting the database to mysqli makes the blog unavailable at all. I have currently set PHP to version 5.5 for the domain http://www.schimanke.org and to version 5.4 for the domain http://www.schimanke.com. While the latter one works without any problems, the .org domain cannot connect to the database. Both domains point to the same website.

User avatar
garvinhicking
Core Developer
Posts: 30015
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by garvinhicking » Mon Jul 11, 2016 2:08 pm

Hi!

What exactly happens then? Do you get error messages? Can you try to set $serendipity['production']=false to see, if you get extended error messages?

Else we can try to debug the include/db/mysqli.inc.php file to see what exactly could be the error message. It could be that for mysqli you need to use another host name (i.e. an IP) so that it works properly...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Wed Jul 13, 2016 11:39 am

Well, all I see is the same error message in the browser, i.e. "serendipity error: unable to connect to database - exiting".

What would be the result if I set $serendipity['production']=false? If possible I would like to avoid taking the blog offline since there is a lot of traffic on it throughout the whole day.

Regarding the other host name... Do you mean the URL of my blog or the host name of the database server? I had tried to set everything according to the information provided by 1&1.

To put it straight, it is currently not a big problem since everything works fine with the old PHP version. I just want to be prepared...

User avatar
garvinhicking
Core Developer
Posts: 30015
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by garvinhicking » Wed Jul 13, 2016 1:09 pm

Hi!
What would be the result if I set $serendipity['production']=false? If possible I would like to avoid taking the blog offline since there is a lot of traffic on it throughout the whole day.
It raises the error reporting, so you would see actual errors. You could just set it for a few minutes, check the actual error output, and then remove the line again.
Regarding the other host name... Do you mean the URL of my blog or the host name of the database server? I had tried to set everything according to the information provided by 1&1.
I meant the hostname of the database server, yes.
To put it straight, it is currently not a big problem since everything works fine with the old PHP version. I just want to be prepared...
We should address that the earlier, the better. It really should work with mysqli, I'd really like to get to the bottom of it.

If the above is no way for you, I would try to create a test script for you that you can run. But since this would take like 15-20 minutes of my time, I'd love to resort to easier methods first :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Wed Jul 13, 2016 1:55 pm

Okay, I set the production variable and received the following error:

== TESTING ERROR MODE ==

mysqli_connect() expects parameter 5 to be long, string given in /.../serendipity/include/db/mysqli.inc.php on line 236

I hope it tells you anything about what's going on there... :-)

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Wed Jul 13, 2016 2:12 pm

And there is another problem now after setting and removing the production variable. When I try to log into the admin backend I now get the following error message:

== SERENDIPITY ERROR ==

Cannot modify header information - headers already sent by (output started at /.../serendipity/serendipity_config_local.inc.php:22) in /.../serendipity/include/functions_config.inc.php on line 721

I'd be happy if we could address this first and soon.

schimanke
Regular
Posts: 155
Joined: Mon Jan 07, 2008 5:38 pm
Location: Hameln, Germany
Contact:

Re: Database problem when updating PHP from 5.4 to 5.5

Post by schimanke » Wed Jul 13, 2016 2:16 pm

schimanke wrote:And there is another problem now after setting and removing the production variable. When I try to log into the admin backend I now get the following error message:

== SERENDIPITY ERROR ==

Cannot modify header information - headers already sent by (output started at /.../serendipity/serendipity_config_local.inc.php:22) in /.../serendipity/include/functions_config.inc.php on line 721

I'd be happy if we could address this first and soon.
Okay, solved it myself. Thanks, Google! ;-)

Post Reply