php5-mysql

Help needed with apache2 and php5-mysql

After upgrading form SuSe 10.1 to openSuse 11.0
I have not been able to use phpMyAdmin or any mysql cmd’s with php5.
I think it must be a config file somewhere but cant solve it.
I have added mysql to the /etc/sysconfig/apache2 APACHE_MODULES but just get a error when restarting apache2
I have added extension=mysql.so in the php.ini file /etc/php5.
Please help

You should add php5, not mysql. Apache only knows about the php5 extension. It’s the php5 extension that will know about mysql, etc.

I have added extension=mysql.so in the php.ini file /etc/php5.

Should not be necessary, installing the php5-mysql module will cause it to be enabled.

Installing phpmyadmin from the DVD or repo will pull in all the dependencies. I hope you did not go to the trouble of installing phpmyadmin from source.

I have added php5 to the APACHE_MODULES in /etc/sysconfig/Apache2 but php5-mysql module is not shown to be loaded.
This module is installed, but when you httpd2 -M it is not shown (php5_module among others is.)

It won’t be. I was just explaining to you that Apache only knows about the php5 module. It doesn’t know about stuff that the php5 module loads.

Here’s the long story:

Apache loads the Apache extension mod_php5.so which is an Apache extension module. Apache is happy, doesn’t know what mod_php5.so will do next.

mod_php5.so is directed by /etc/php5/conf.d/mysql.ini to load mysql.so which is a PHP5 extension.

To find out what PHP5 has loaded you should put a PHP script containing this:

<?php
phpinfo()
?>

in some file ending in .php in the webserver’s documents. Provided you have enabled php5 in APACHE_MODULES, the resulting web page will show you what PHP5 modules have been loaded into PHP.

Ok I have a test.php file and the ouput for loaded modules is the following:

core prefork http_core mod_so mod_rewrite mod_authz_host mod_actions mod_alias mod_auth_basic mod_authz_groupfile mod_authn_file mod_authz_user mod_autoindex mod_cgi mod_dir mod_include mod_log_config mod_mime mod_negotiation mod_setenvif mod_status mod_userdir mod_asis mod_imagemap mod_perl mod_python mod_authz_default mod_php5

the cmd rpm -qa | grep php5 showes following:

php5-sockets-5.2.6-32.3
php5-pear-mail_mime-1.5.2-72.1
php5-iconv-5.2.6-0.1
php5-openssl-5.2.6-0.1
php5-curl-5.2.6-32.3
php5-mbstring-5.2.6-0.1
php5-sqlite-5.2.6-32.3
php5-tidy-5.2.6-32.3
php5-calendar-5.2.6-32.3
php5-exif-5.2.6-32.3
php5-5.2.6-32.3
apache2-mod_php5-5.2.6-32.3
php5-imap-5.2.6-32.3
php5-xsl-5.2.6-32.3
php5-pear-db-1.7.12-101.1
php5-gmp-5.2.6-32.3
php5-dom-5.2.6-32.3
php5-pdo-5.2.6-0.1
php5-soap-5.2.6-32.3
php5-bcmath-5.2.6-32.3
php5-pear-mail-1.1.14-158.1
php5-mcrypt-5.2.6-0.1
php5-zip-5.2.6-32.3
php5-fastcgi-5.2.6-32.3
php5-ftp-5.2.6-32.3
php5-pear-auth_sasl-1.0.2-179.1
php5-mysql-5.2.6-32.3
php5-zlib-5.2.6-0.1
php5-pspell-5.2.6-32.3
php5-pear-5.2.6-0.1
php5-pear-file-1.3.0-95.1
php5-odbc-5.2.6-32.3
php5-gd-5.2.6-32.3
php5-bz2-5.2.6-32.3
php5-pear-date-1.4.7-95.1
php5-ctype-5.2.6-32.3
php5-readline-5.2.6-32.3
php5-pear-log-1.9.11-95.1

So where do I go now ?
I have tried re-install of php5 and php5-mysql

So what happens if you go to the home page of your phpmyadmin install? This would be http://localhost/phpMyAdmin/

If the page doesn’t render, then look in /var/log/apache2/error_log for problems.

Naturally this assumes you have mysql running on localhost.

Ok I tried running php5 from the command line on a file and found that I get error like this :

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/extensions//usr/lib/php5/extensions/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0’

This looks like somewhere ther are 2 instances of the path joined /usr/lib/php5/extensions/

But where are the directives ?
:frowning:

Maybe it’s the directives you added to php.ini that you didn’t really need to?

yep thought the same but I have gone around the directories and deleted any php.ini files except the one in /etc/php5/apache2 and in that one I have commented out the line extension_dir=/usr/lib/php5/extensions ith a ;
The restarted apache2

:confused:

Maybe you should reinstall php5 and apache2-mod_php5 to get a clean state and take it from there.

Hi Ken
Thanks for the reply I have been away until now but I removed php5 and apache2 yesterday then re-installed both. Now the error message has changed to:
PHP Warning: Module ‘mysql’ already loaded in Unknown on line 0
and same warning for SQLite.
I thought I had removed all the conf files etc from /etc/apache2 and /etc/php5 so I will try again and see what happens
:confused:

It sounds like you have mentioned mysql.so twice somewhere in the config files for PHP. Looking at the organisation of /etc/php5/, these are the subdirectories:

apache2: contains php.ini for configuring behaviour under Apache
cli: contains php.ini and pear.ini for configuring behaviour when run from the CLI
conf.d: contains for each PHP5 module a file that is used to enable (or disable, when commented out) loading of the module, so mysql.ini contains:

extension=mysql.so

So it would seem that it’s a mistake to mention extension=mysql.so again in either php.ini. And of course, you should not mention mysql.so in any of the other .ini files in conf.d.

You should see if there are any other .ini files under /etc. It could be that PHP5 looks at other directories, for example /etc/php/, for compatibility reasons.

Meanwhile as it’s only a warning, you should be able to proceed to try out phpMyAdmin.