MySQL reported: MySQL not connected errors

Hi,

I reinstalled Zenphoto 1.4.5 on my webspace. An older zenphoto version was running before. I deleted the old folder and installed the new version. However in the setup script I get an error message that zenphoto can’t connect to my mysql server. I used the same setting as before; I even copied the old config file into the zp-data directory, but still not working. What could be the problem?
The seup log says:
Zenphoto Setup v1.4.5[5cffbe455e] clone: Tue, 09 Jul 2013 11:21:14 +0000
Query error: MySQLi not connected
Warnung:zp-data-Protokollsicherheit [ist gefährdet] Zenphoto empfiehlt, die sensiblen Dateien im zp-data-Order nur für den Owner zugänglich zu machen (Zugrifssrechte = 0600). Die Dateizugriffsrechte für setup.log sind 0644, was unerlaubten Zugriff erlauben kann.
Thanks for your help

Norbert
«1

Comments

  • acrylian Administrator, Developer
    Looks like the file/folder permissions are messed up on the server so ZP could not read the file.

    I would suggest to let setup create a new one by filling in the db credentials manually.
  • Noppes Member
    Thanks for your reply. As I mentioned I deleted the whole zenphoto folder incl. the config file. The setup ask me for the database setting and the setup stored the setting succesful in the config file. However, the setup still could't connect to the database, so I replaced the config file with the old one and it was still not working.
  • Failure to connect to the database is almost always a problem with the credentials you supplied.

    The error you reported above, however, is a permissions issue and not necessarily a problem. You are being told that the log files are not protected as well as they might be. In your case they can be read by anyone in the group your user id is in. Not necessarily a problem.

    Have you had different errors? Perhaps the SQL connection error is shown somewhere?
  • Noppes Member
    I did some more test. I installed Zenphoto 1.4.1 successful, so it is definitely related to the new zenphoto version 1.4.5

    When I run the setup on the new version those three items have only a green dot without the check mark:

    PHP MySQLi support
    PHP PDO_MySQL support
    PHP MySQL support

    Could it be that you change the sql engine and the new engine is not working with my server?

    PHP ( 5.4.5) info says the following things about mysql

    mysql
    MySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version 5.1.49
    MYSQL_MODULE_TYPE external
    MYSQL_SOCKET /var/run/mysqld/mysqld.sock
    MYSQL_INCLUDE -I/usr/include/mysql
    MYSQL_LIBS -L/usr/lib -lmysqlclient

    Directive Local Value Master Value
    mysql.allow_local_infile On On
    mysql.allow_persistent On On
    mysql.connect_timeout 60 60
    mysql.default_host no value no value
    mysql.default_password no value no value
    mysql.default_port no value no value
    mysql.default_socket /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock
    mysql.default_user no value no value
    mysql.max_links Unlimited Unlimited
    mysql.max_persistent Unlimited Unlimited
    mysql.trace_mode Off Off

    mysqli

    MysqlI Support enabled
    Client API library version mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $
    Active Persistent Links 0
    Inactive Persistent Links 0
    Active Links 0

    Directive Local Value Master Value
    mysqli.allow_local_infile On On
    mysqli.allow_persistent On On
    mysqli.default_host no value no value
    mysqli.default_port 3306 3306
    mysqli.default_pw no value no value
    mysqli.default_socket no value no value
    mysqli.default_user no value no value
    mysqli.max_links Unlimited Unlimited
    mysqli.max_persistent Unlimited Unlimited
    mysqli.reconnect Off Off
  • None of these are error reports. So we still have no clue as to what is happening on your server.
  • Noppes Member
    When I run the older Zenphoto 1.4.1 setup I have a green circle with a green check mark on this item:
    PHP MySQL support
    The other two ones are only a green circles.

    When I run the Zenphoto 1.4.5 setup I have a only three green circle without check mark on those items:
    PHP MySQLi support
    PHP PDO_MySQL support
    PHP MySQL support

    Why is there a difference? What does a green circle mean and a green circle with a check mark?
  • Look, if you won't tell us what errors you are getting we will get nowhere with this.
  • Noppes Member
    Sbillard,

    the only error message that I get with zenphoto 1.4.5 is: Query error: MySQLi not connected, even if I put in the correct credentials (they works with older zenphoto installation). Now I was trying to find out why zenphoto 1.4.1 works and 1.4.5 not. The only thing that is different during installation is that the php mysql has the green check mark in the 1.4.1 installation and 1.4.5 only a green circle and the error message mentioned above.
  • acrylian Administrator, Developer
    And we try to help. But without any proper error message it is hard to do so.

    So MySQLi does not work so try to set another one on your server. I can assure that 1.4.5 works on the same environment as 1.4.1 an standard shared hosts.
  • But problem not solved it shows

    Database credentials in configuration file
    Error!

    MySQLi reported: MySQLi not connected
  • acrylian Administrator, Developer
    So is MySQLi available and working, are the credentials correct and most important are there errors in the server log and if which?
  • PHP display_errors [is enabled]
    Warning!

    This setting may result in PHP error messages being displayed on WEB pages. These displays may contain sensitive information about your site.

    File Permissions [are loose (0666)]
    Warning!

    If file permissions are not set to strict or tighter there could be a security risk. However, on some servers Zenphoto does not function correctly with tight file permissions. If Zenphoto has permission errors, run setup again and select a more relaxed permission.

    Set File permissions to

    These are some other problem when installing Yes Mysqli is working
  • acrylian Administrator, Developer
    That is not the server error log as that might have things that don't get to show. Please look there.

    None of these have to do with MySQL unless the config file cannot be read. Which the error log should tell about.
  • Noppes Member
    Where do I need to look for an error message? Which log file? I was wondering if someone could tell me if the new version has a different database engine (mysqli instead of mysql)? And my other question is what does it mean that the installation program don't show the green circle icon with a check mark on the lines:
    PHP MySQLi support
    PHP PDO_MySQL support
    PHP MySQL support
    It shows only a green circle. Does it mean it can't find the neccessary libraries?
    THanks for your help

    Norbert
  • acrylian Administrator, Developer
    You have to look where ever your server stores the error log. Your host will know as it is different on all.

    The error means it cannot connect. We need more info what exactly cannot connect. The credentials, the php extension itself. Which we don't really know. Zenphoto has no new engine and uses the mysql extension that your server php provides. That are the MySQL (deprecated in PHP 5.3+), the MySQLi (recommended to be used instead the former) and PDO.
  • Your error report would suggest that there is a problem with your configuration. But since the error gives no further information we cannot know why it is not connecting.

    You can always override to use MySQL instead of MySQLi since that worked on the older version. There is a selector for that or you can change the configuration file directly.
  • Noppes Member
    Ok, in the error logfile is nothing related to zenphoto. I installed now zenphoto 1.4.4.8. The database connection is not working with mysqlI, however when I switch in the setup to the old mysql it is working (I only get the warning that I use the MySQL version 5.1.49 and zenphoto would prefer 5.5). In zenphoto 1.4.5 I can't switch to mysql; I can choose it in the setup, however zenphoto is always switching back to mysqlI.
    My summery is: mySQLi is not working on my webspace as zenphoto would like and zenphoto 1.4.5 has bug that don't allow me to change to the old mysql. Does it make sense?
  • Zenphoto will prefer to use MySQLi if it is present as MySQL had been deprecated. If MySQLi does not work on your server you should do one of two things.

    1 (preferred)get your host to fix whatever is wrong with their insatllation.

    2. Disable the PHP MySQLi module in your PHP.ini settings.
  • I disable Mysqli connection from php.ini now
    it shows

    Database credentials in configuration file
    Error!
    PDO::MySQL reported: PDO::MySQL not connected

    where is configuration file i am tring to install from last two days
  • Located in the zp-data folder. But the credentials are shown on the setup page where that error appears.
  • Noppes Member
    My webspace provider told me that mysqli is enabled, however he would like to have more details what zenphoto is requiring/recommending for propper work.
  • I have the same issue, and installation fails for 1.4.4.3 as well as 1.4.5. I have installed 1.4.4.3 successfully on another site, but this one just up and failed (on its own, without trying to install anything), although it may be a complication from either a SQL upgrade by my host or a server migration... However, my other Zenphoto sites had no issues so I'm stumped. Will see what my host says...

    edit: the original error I got was
    your installation has moved from /home2/... to /home1/
    your database software has changed from MySql 5.5.29 to 5.5.32
    Please reinstall the following setup files from 1.4.3.4...

    Do I need to follow those instructions rather than simply upgrading like I was going to do?
  • You would be advised to perform the re-install before attempting an upgrade. It is never a good idea add complexity to a situation that is not needed to a not working installation.
  • You're right. Restoring to a backup and performing the operations as indicated resolved my particular issue. Thanks.
  • Noppes Member
    I am just wondering if someone could give me the specific requirements in order to use mysqli? I believe I am not the only one that has problems to get mysqli to run. My webspace provider would like to help to get zenphoto to run, however he need to get more information what settings mysqli needs.

    Thanks for your help
    Norbert
  • acrylian Administrator, Developer
    The point is there is nothing that specific.
  • Zenphoto does exactly the same functions using MySQLi as it does when it uses MySQL. Only the PHP interface is different. But as to specifics, I have said before that the problem is with the credentials you have supplied. For whatever reason they do not work on MySQLi. That is the question to ask of your provider.

    In the mean time, why haven't you taken the other suggestion and disabled the MySQLi support in your PHP ini file so that Zenphoto will use MySQL just like it did on your older release? I'm betting that will not work either because of some sort of credentials problem.
  • Noppes Member
    Sbillard, thanks for your help. My Zenphoto installation is working fine with mysql, but not with mysqli. I used the same credentials. It is truly a mysqli problem. However, my websapce provide don't have a clue what is wrong. Mysqli is enabled and he don't know what to do.
  • Hi,

    I just had the same problem when trying to upgrade to ZenPhoto 1.4.5.1.
    My host has php 5.3.26 and mysql 5.5.30.
    Now, although mysqli is installed and enabled, I couldn't get it to work with ZP (I don't remember if in the older versions I used it or mysql driver). The thing is, that during setup, I could select the mysql driver, and then that step would work, but the next setup step (for example, delete extra file) would revert back to using mysqli and thus fail to connect again.
    This happened even if I edited the config file manually. It seems there's a bug in the setup script which overwrites the config at every step and reverts it back to using mysqli.
    The workaround I found for this was to manually edit the config file to change it to use mysql driver, before continuing to the next step, for each step.

    It would be nice if I found why mysqli doesn't work on my host with ZP, but unfortunately I don't have time to debug this. I had to get this upgrade done and move on with my life :)
    But in any case, it is definite that there's a bug in the setup script which overwrites the user selection of DB driver, and this happens at every step of the setup.

    Cheers,
    o
  • acrylian Administrator, Developer
    If you can please try the support build (probably not on a production site) to see if this is fixed now. Otherwise we will carry issues with the next release since especially since I didn't encounter this issue on several shared hosts.
Sign In or Register to comment.