You are not logged in.

#1 2007-09-25 05:21:42

Jerry
Member
From: Philippines
Registered: 2007-09-14
Posts: 126

PHP's mysql extension not working.

I'm having this fatal error:

 Fatal error: Call to undefined function mysql_connect() in ...

I have read the forum archives about this problem and found nothing that would work for me. this one closely resemble my problem.

http://bbs.archlinux.org/viewtopic.php?id=23754

I have followed the wiki and reread it as much as I could but I couldn't, for the life of me, figure out what is wrong. I've also edited my php.ini with this if its of some help.

;extension=mysql.so to extension=mysql.so

since this one that was on the above thread was, I believe, applicable in lower versions of php or a port of php for windows

;extension=mysql.dll

to

extension=mysql.so

I've also scrape up what I could in google, php.net, and abmysql, and found that newer php have no mysql-extension by default. and needs to be compiled with it.  If this was the case I guess the package we have at our repositories would never work with mysql and we have to recompile our own php with the mysql extensions?

After fiddling, I no longer recognize my system (php.ini, apache config, mysql config) thus, I felt compelled to reinstall arch (for that fresh feeling)... just waiting for the new snapshot. Somehow I've messed up trying to fix my system and phpmyadmin won't work with mysql anymore, so that's a reason too.

Did anyone else had this problem with PHP5? And are the PHP-5 arch package compiled with mysql extension by default?

Offline

#2 2007-09-25 05:23:02

Jerry
Member
From: Philippines
Registered: 2007-09-14
Posts: 126

Re: PHP's mysql extension not working.

btw thanks in advance

Offline

#3 2007-09-25 06:26:52

Evelynn
Member
Registered: 2007-09-05
Posts: 4

Re: PHP's mysql extension not working.

Check if you have "extension_dir" variable in php.ini set to point to "/usr/lib/php/extensions/php".

If that doesn't work, try installing libmysqlclient.

Offline

#4 2007-09-25 07:53:49

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: PHP's mysql extension not working.

See you syslog for any error message or enable error outpt in you php.ini.

Offline

#5 2007-09-28 16:07:48

Jerry
Member
From: Philippines
Registered: 2007-09-14
Posts: 126

Re: PHP's mysql extension not working.

I'm afraid and terribly sorry that I wasn't able to follow any of the advice since I was doing critical work and I needed a working machine asap (I already lost 5 hours of production time) so I did a debian install temporarily. Now that I've though about it I should have just gparted my harddrive for the debian install.   Work is done and I'm going to reinstall archlinux this weekend.  The advice you gave would come in handy if the problem ever presented itself to me again.

Evelynn: I already did the what you told me beforehand and it didn't work for me.  But I have to admit I couldn't be 100% sure if it was me or the machine because I was also in a hurry. I might not have remove some other configuration that I set in php.ini and those might have cause the other problems (like mysql and phpMyAdmin not working together.) that rendered my lamp setup unresponsive. I tried other suggestions in tweaking other files as well so the way I handled debugging the operating system was really chaotic and poorly done.

Pierre: Those syslog, are they the error that your browser shows you after php parses your codes? Yes I turned them on, I use them for debugging my codes.  If it was something else I would like to know where could I find them.

Offline

#6 2007-10-18 02:11:22

crouse
Arch Linux f@h Team Member
From: Iowa - USA
Registered: 2006-08-19
Posts: 907
Website

Re: PHP's mysql extension not working.

;extension=mysql.so to extension=mysql.so

Then restarting apache fixed it for me.........  I had to move the new php.ini.pacnew to php.ini and uncomment the line above.  I did of course backup the original php.ini file FIRST wink

Last edited by crouse (2007-10-18 02:11:59)

Offline

#7 2008-04-18 02:26:06

jimmyeatapple
Member
Registered: 2008-03-11
Posts: 8

Re: PHP's mysql extension not working.

I am getting a similar problem, I have un commented mysql.so, I have added (with no luck) libmysqlclient.so hoping that might have been a gotcha.

I enabled errors in the webpages themselves, so rather than displaying nothing after the error it displays
Fatal error: Call to undefined function mysql_select_db() in /home/httpd/html/tables.php on line 21

on line 21 there is the call to the db. It looks just like NUMEROUS tutorials out there so I am pretty sure it isn't that.

Offline

#8 2008-04-18 21:43:14

jimmyeatapple
Member
Registered: 2008-03-11
Posts: 8

Re: PHP's mysql extension not working.

Sadly, installing Ubuntu's Lamp Install worked the first try.

The major difference looks to be php.

When you grab phpinfo, there mysql, and mysqli is missing from the configuration section in Arch, and yes, I uncommented mysql.so in the php.ini file.

I think the lamp how/to needs to be redone because something has broken them.

Offline

Board footer

Powered by FluxBB