View Full Version : Core 4 PHP amd MySQL Setup
simon_r2d2
10th November 2005, 10:46 AM
I am going to hold my hand up straight away as a bit of a Linux/Fedora newbie.
I have installed Core 4 and upgraded to MySQL5 (my original install included MySQL4 which I removed and then installed MySQL5 from the official RH RPM's.)
Both PHP5 and MySQL5 work fine as separate entities.
The snag is this... When i display a page containing the phpinfo(); command, it shows the Configure command as '--without-mysql'. This (unless I am reading it wrong) tells me that PHP is running with MySQL support turned off.
This sems to be confirmed by the fact that if I open a page which tries to access a MySQL database, I get the PHP error 'Call to undefined function mysql_connect()'
I can't find out how to turn on MySQL support easily. I keep seeing references to running the ./configure command again, but am not sure where to do this from....
Any help gratefully received.....
Simon
giulix
10th November 2005, 10:56 AM
Add the relevant module (mysql.so) to /usr/lib/php/modules.
Spoon!
10th November 2005, 11:02 AM
yum install php-mysql
simon_r2d2
10th November 2005, 11:03 AM
It's already there......
giulix
10th November 2005, 11:05 AM
Then add the following line to /etc/php.ini
extension=mysql.so
simon_r2d2
10th November 2005, 11:08 AM
Got the following output....
Setting up install process
Setting up repositories
Cannot find a valid baseurl for repo: updates-released
Result is that is still doesn't work. Is it right that FC4 comes with MySQL PHP support turned off? Isn't this a bit unusual?
giulix
10th November 2005, 11:14 AM
It does, but Mysql 5 is brand new. You are customizing your installation, so either you set it up yourself or wait for FC5.
simon_r2d2
10th November 2005, 11:16 AM
OK, I have checked that mysql.so exists in the right folder and added the extenstion line to the php.ini file. I have also rebooted and checked again.... I still get the 'call to undefined function' error... and the phpinfo page still says '--without-mysql'
Any more ideas?
giulix
10th November 2005, 11:23 AM
What does php -m return ?
simon_r2d2
10th November 2005, 11:36 AM
ooh, thats interesting i get this....
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - libmysqlclient.so.14: cannot open shared object file: no such file or directory in Unknown on line 0
This is repeated a total of three times. Looking down the list of loaded modules, MySQL is (unsurprisingly) not there... does this help?
giulix
10th November 2005, 12:17 PM
Yes, but you should provide the requested info:
.A listing of /usr/lib/php/modules
.The output of 'php -m'
.The contents of the 'extension' section of your /etc/php.ini
simon_r2d2
10th November 2005, 12:38 PM
OK, here goes....
listing of /usr/lib/php/modules:
bcmath.so
dba.so
dom.so
gd.so
imap.so
ldap.so
mbstring.so
mysqli.so
mysql.so
ncurses.so
odbc.so
pgsql.so
snmp.so
soap.so
xmlrpc.so
xsl.so
Output of 'php -m':
PHP Warning: PHP Startup: unable to load dynamic library '/usr/lib/php/modules/mysql.so' - libmysqlclient.so.14: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: unable to load dynamic library '/usr/lib/php/modules/mysql.so' - libmysqlclient.so.14: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - libmysqlclient.so.14: cannot open shared object file: No such file or directory in Unknown on line 0
[PHP modules]
bcmath
bz2
calendar
ctype
curl
dba
dbx
dio
dom
exif
ftp
gd
gettext
gmp
iconv
imap
ldap
libxml
mbstring
mime_magic
ncurses
odbc
openssl
pcntl
pcre
pgsql
posix
pspell
session
shmop
SimpleXML
snmp
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlrpc
xsl
yp
zlib
[Zend Modules]
Contents of 'extension' section of /etc/php.ini
extension=mysql.so
OK, think thats everything. To recap - I am installing MySQL5 onto FC 4 after uninstalling (using RPM) MySQL 4. Both PHP and MySQL are now at version 5, by phpinfo() reports '--without-mysql' and I cannot connect to MySQL databases from a php script.
PLEASE HELP......
Simon
sej7278
10th November 2005, 01:26 PM
php5 no longer comes with mysql support bundled, it has mysqli now (mysql improved) which gives you the full functionality of mysql 4.1 and 5.0 (the old mysql module officially only works with 3.x/4.0).
the problem with this is that you have to change all your mysql calls to calls to mysqli, and products that haven't migrated fully (like postnuke and drupal) just won't work with it.
solution: go back to php 4.4.1 with the old mysql module, and go back to mysql 4.0 (in fact 4.1.13 works for me).
it's a bit of a stupid move by the php guys i think, as it means if you want php5 you have to use mysql5 (and apache2 iirc) and fix all your scripts.
libregeek
10th November 2005, 01:36 PM
Just one more query?
How did u installed php5? from the source or from rpm?
If it's compiled from binary paste your configure script here.
llibregeek
giulix
10th November 2005, 02:54 PM
Ok, there's one more thing you can try: make sure you've got /etc/ld.so.conf.d/mysql-i386.conf and /etc/ld.so.conf.d/mysqlclient10-i386.conf
/usr/lib/mysql
The code above is the content of both files. If your Mysql 5 libraries are located in a different place, modify accordingly. Then run ldconfig.
Omega Blue
11th November 2005, 03:54 AM
It says PHP5 doesn't include MySQL client libraries by default, so you need to build it yourself, or go back to PHP4.
rupert160
10th December 2006, 04:16 AM
There's a lot of good explaination on the post:
http://fedoranews.org/cms/node/411
however I too had a problem. The above solution was to compile the PHP 5.2 code from source and have the --with-mysql option as a flag. When compiling I got the error: The PCRE extension requires PCRE library version >= 6.6
as PHP 5.2 (not the other authors version I believe) has had "Updated bundled PCRE library to version 6.6. " from 5.1.3
I tried the RPM: rpm -i /root/Desktop/pcre-devel-6.6-1.fc4.remi.i386.rpm
however I got:
error: Failed dependencies: pcre = 6.6-1.fc4.remi is needed by pcre-devel-6.6-1.fc4.remi.i386
there doesn't seem to be an rpm to help me. any ideas?
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.