469,626 Members | 1,016 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

How to configure MySql support?

I've just loaded phpMyAdmin on a Debian Linux server with Apache2, MySql5 and
PHP5.

myserver [/root] # dpkg -l | grep php
ii libapache-mod-php5 5.2.0-8+etch4
ii libapache2-mod-php4 4.4.4-8+etch2
ii php4-common 4.4.4-8+etch2
ii php5-common 5.2.0-8+etch4
ii php5-gd 5.2.0-8+etch4
ii php5-mcrypt 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4
ii phpmyadmin 2.9.1.1-3

myserver [/root] # dpkg -l | grep mysql
ii libdbd-mysql-perl 3.0008-1
ii libmysqlclient15off 5.0.32-7etch1
ii mysql-client-5.0 5.0.32-7etch1
ii mysql-common 5.0.32-7etch1
ii mysql-server 5.0.32-7etch1
ii mysql-server-5.0 5.0.32-7etch1
ii php5-mysql 5.2.0-8+etch4
When I try to use phpMyAdmin, I get an error:

"Cannot load mysql extension. Please check your PHP configuration."

There's a link in the error that points to http://us.php.net/mysql, which says:

Use the --with-mysql[=DIR] configure option to include MySQL support.

But in the above package list, it shows "php5-mysql" is already installed. Do I
need to add this module to PHP? How?

Can someone please help me understand how to configure PHP with MySql support?

Many thanks.

Jun 5 '07 #1
8 6806
deko wrote:
I've just loaded phpMyAdmin on a Debian Linux server with Apache2,
MySql5 and PHP5.

myserver [/root] # dpkg -l | grep php
ii libapache-mod-php5 5.2.0-8+etch4
ii libapache2-mod-php4 4.4.4-8+etch2
ii php4-common 4.4.4-8+etch2
ii php5-common 5.2.0-8+etch4
ii php5-gd 5.2.0-8+etch4
ii php5-mcrypt 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4
ii phpmyadmin 2.9.1.1-3

myserver [/root] # dpkg -l | grep mysql
ii libdbd-mysql-perl 3.0008-1
ii libmysqlclient15off 5.0.32-7etch1
ii mysql-client-5.0 5.0.32-7etch1
ii mysql-common 5.0.32-7etch1
ii mysql-server 5.0.32-7etch1
ii mysql-server-5.0 5.0.32-7etch1
ii php5-mysql 5.2.0-8+etch4
When I try to use phpMyAdmin, I get an error:

"Cannot load mysql extension. Please check your PHP configuration."

There's a link in the error that points to http://us.php.net/mysql,
which says:

Use the --with-mysql[=DIR] configure option to include MySQL support.

But in the above package list, it shows "php5-mysql" is already
installed. Do I need to add this module to PHP? How?

Can someone please help me understand how to configure PHP with MySql
support?

Many thanks.
First of all, what does phpinfo() say about MySQL support? It's the
only authoritative answer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 5 '07 #2
deko wrote:
ii libapache-mod-php5 5.2.0-8+etch4
ii libapache2-mod-php4 4.4.4-8+etch2
ii php4-common 4.4.4-8+etch2
ii php5-common 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4
I've snipped out some of the irrelevant packages. Note you have two copies
of PHP installed -- PHP4 and PHP5. You only have the MySQL extension
installed for PHP5, not PHP4. So if your script is running in a PHP4
environment, then the MySQL functions will not work.

I'd recommend removing php4-common and libapache2-mod-php4, and then
installing libapache2-mod-php5 if such a beast exists. Then try.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 102 days, 1:11.]

URLs in demiblog
http://tobyinkster.co.uk/blog/2007/05/31/demiblog-urls/
Jun 5 '07 #3
>ii libapache-mod-php5 5.2.0-8+etch4
>ii libapache2-mod-php4 4.4.4-8+etch2
ii php4-common 4.4.4-8+etch2
ii php5-common 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4

I've snipped out some of the irrelevant packages. Note you have two copies
of PHP installed -- PHP4 and PHP5. You only have the MySQL extension
installed for PHP5, not PHP4. So if your script is running in a PHP4
environment, then the MySQL functions will not work.

I'd recommend removing php4-common and libapache2-mod-php4, and then
installing libapache2-mod-php5 if such a beast exists. Then try.
Great! Thanks for the tip. I've been trying to build a Debian LAMP server with
Samba and phpMyAdmin. I think I've got everything completed except the PHP
configuration. Apparently, PHP5 does not come with Debian Etch by default, and
PHP does not come with MySql support by default.

Debian is great, but all the install/configure tasks are not well documented as
much is distro-specific. But I did get Apache and Samba working. MySql appears
to be installed by default.

Jun 7 '07 #4
deko wrote:
Apparently, PHP5 does not come with Debian Etch by default,
Really?

What sources have you got configured for packages? Are they all "stable"?
If so, add some "testing" sources in, and see if PHP5 is available for
install.

Debian is notorious for including fairly old versions of packages in its
"stable" branch. The "testing" branch has a lot more polish and stability
than its name gives it credit for, and is perfectly suitable for a
production server.

Try:
apt-get install apache2 libapache2-mod-php5 php5-cli php5-common php5-cgi

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 103 days, 19:57.]

URLs in demiblog
http://tobyinkster.co.uk/blog/2007/05/31/demiblog-urls/
Jun 7 '07 #5
I'd recommend removing php4-common and libapache2-mod-php4, and then
installing libapache2-mod-php5 if such a beast exists. Then try.
After using 'dpkg -r' and 'dpkg --purge', I ended up with this

bubba [/root] # dpkg -l | grep php
ii libapache-mod-php5 5.2.0-8+etch4
ii php5-common 5.2.0-8+etch4
ii php5-gd 5.2.0-8+etch4
ii php5-mcrypt 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4
ii phpmyadmin 2.9.1.1-3

There is a libapache2-mod-php5, but not sure if I need this:
http://packages.debian.org/unstable/...ache2-mod-php5

How do I add php5 to apache? If I issue the a2enmod command, I get a list of
module names that I could enable - the problem is I don't see php5 in the list.

Jun 8 '07 #6
deko wrote:
bubba [/root] # dpkg -l | grep php
ii libapache-mod-php5 5.2.0-8+etch4
ii php5-common 5.2.0-8+etch4
ii php5-gd 5.2.0-8+etch4
ii php5-mcrypt 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4
ii phpmyadmin 2.9.1.1-3

There is a libapache2-mod-php5, but not sure if I need this:
http://packages.debian.org/unstable/...ache2-mod-php5
dpkg -l | grep apache

See which version of Apache you are using. Apache 1.3 and Apache 2.x are
both fairly common -- Debian provides packages of each. (Most distros do.)

If you're running Apache 1.x, then use libapache-mod-php5;
if you're running Apache 2.x, then use libapache2-mod-php5.

If you seem to have both Apache 1.3 *and* Apache 2.x installed, then
uninstall one of them -- you'll only end up confusing yourself!

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 104 days, 17:28.]

URLs in demiblog
http://tobyinkster.co.uk/blog/2007/05/31/demiblog-urls/
Jun 8 '07 #7
dpkg -l | grep apache
>
See which version of Apache you are using. Apache 1.3 and Apache 2.x are
both fairly common -- Debian provides packages of each. (Most distros do.)
myserver [/root] # dpkg -l | grep php
ii libapache2-mod-php5 5.2.0-8+etch4
ii php5 5.2.0-8+etch4
ii php5-common 5.2.0-8+etch4
ii php5-gd 5.2.0-8+etch4
ii php5-mcrypt 5.2.0-8+etch4
ii php5-mysql 5.2.0-8+etch4
ii phpmyadmin 2.9.1.1-3
myserver [root] # dpkg -l | grep apache
rc apache-common 1.3.34-4.1 *<<=== what does 'rc' mean? *
ii apache2-doc 2.2.3-4
ii apache2-mpm-prefork 2.2.3-4
ii apache2-utils 2.2.3-4
ii apache2.2-common 2.2.3-4
ii libapache2-mod-perl2 2.0.2-2.4
ii libapache2-mod-php5 5.2.0-8+etch4
ii libapache2-mod-python 3.2.10-4
myserver [/root] # apache2ctl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
python_module (shared)
negotiation_module (shared)
perl_module (shared)
php5_module (shared)
setenvif_module (shared)
status_module (shared)
Syntax OK
myserver [/root] # mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.32-Debian_7etch1-log Debian etch distribution

================================================== =

The problems now are:

-- blank page when accessing phpinfo.php
I tried adding 'AddType application/x-httpd-php .php' to my apache2.conf file
(and restarting apache), but no luck.
Do I have to recompile apache?

--Error when trying to access phpMyAdmin:
Error: 'The configuration file now needs a secret passphrase (blowfish_secret).'
I tried modifying config.inc.php by uncommenting this line:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
but no luck.

Don't I need some mysql apache module loaded?
How do I tell apache2 to load a module?

Jun 9 '07 #8
got it working:

myserver [/etc/phpmyadmin] # vi config.inc.php
<?php
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = ''; // MySQL port (leave blank for
default port)
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method: config,
http, or cookie
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password
?>

myserver [/usr/share/phpmyadmin] # vi phpinfo.php
<?php
phpinfo();
?>

For some reason the default phpinfo.php does not work - just returns a blank
page.

Getting the correct packages installed was half the battle... understanding the
Debian packaging system (apt, aptitude, dpkg, dselect) and knowing how to
configure everything with all the Debian Etch platform-specific peculiarities...
all without documentation.

Jun 10 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by compu_global_hyper_mega_net_2 | last post: by
reply views Thread by Roy Shaw | last post: by
9 posts views Thread by ibm_97 | last post: by
7 posts views Thread by Brent Halsey | last post: by
1 post views Thread by Jim McCullars | last post: by
1 post views Thread by gquiring | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.