-   Linux - Newbie (
-   -   apache, php, mysql on linux (

MrSako 07-11-2006 01:12 PM

apache, php, mysql on linux
i have apache installed works great

i have php installed, my php scrpits online work great

mysql is installed. doesnt work with php though. i tried to run a php script that connects to my mysql database. on my error log it got that the connect command wasn't recognises. meaning mysql and php arent set up to work togethor properly

the php version is 5 and mysql version is 4

what config files and settings do should i look through to double check stuff is set right so that mysql will work wiht php?

muha 07-11-2006 01:32 PM

Heja, what command did you give to get which error exactly?
Have you checked whether mysql is running?

nickk 07-11-2006 01:55 PM

I was just about to post this exact same question. I think he means that he gets a
"Fatal error: Call to undefined function: mysql_connect() in /var/www/html/test/index.php" error. I have the exact same problem as I'm useless with Linux. In windows you just uncomment a line in php.ini to include the mysql module. How do you do this in linux (Red Hat enterprise) without recompiling php or apache?


jstephens84 07-11-2006 02:53 PM

That error normally means that you do not have the mysql module loaded for php. Can you post your php config file? Their was a change I had to make on my system to get it running right.

nickk 07-11-2006 03:20 PM


; Dynamic Extensions ;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;  extension=modulename.extension
; For example:
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.
; Note: For Red Hat Linux, packaged extension modules are now loaded via
; the ini files in the directory /etc/php.d.

You see, is included as a module and it does exist in the extension_dir but it still doesnt work

jstephens84 07-11-2006 03:25 PM

You should find in their an option that says something like extension_DIR. You must set that to where your modules for php reside.

jstephens84 07-11-2006 03:34 PM

Ok, so I think I found it. If you look at line 398 or close to it you will see extension_dir.
This should point to /usr/lib/php/extensions.(This is if you are using slackware.) I am not sure where Ubuntu and other distro's keep these modules. Just one suggestion. I would use myslqi. so your commands would be mysqli_connect(). mysqli has extended functionality.

nickk 07-11-2006 03:36 PM

arrrg my extension_dir is correct, but it still deosnt work, what could it be?

jstephens84 07-11-2006 03:58 PM

have you restarted httpd. also check to make sure your extensions are at that location. could you post your whole php.ini file.

MrSako 07-11-2006 05:43 PM

yes i hjave the same error

[client] PHP Fatal error: Call to undefined function mysql_connect() in /var/www/html/phpinfo.php on line 8

im going to try and add that line into my php ini

MrSako 07-11-2006 05:55 PM

ok i was given an error saying it cant find in that directory.

in my ini file

extension_dir = "/usr/lib/php/modules"

i just checked that directory and nothing was in it.

so i searched the machine for the only result was


which cant be the same for php im thuinking its probally something for perl

im confused of what to do.
(please dont confuse me with the other guy with the asme problem)

oh yeh, yes mysql is running and working. i even put a database and tables in it

jstephens84 07-11-2006 06:32 PM

MrSako copy over that then restart your apache web server then see if it works.

Best way is to run the following script.

<title>PHP Apache Mysql Test</title>

It will tell you what all php has loaded.

MrSako 07-11-2006 06:42 PM


jstephens84 07-11-2006 07:37 PM

Well a couple of good things came out of this. One we know apache and php are working together. We also
know that php did not load the . If you look under mime_magic it goes straight into the o's.
I am currently installing Debian on my Server at the house. Once it completes I may have a look to see
if I can tell of any differences from slackware. By the way What Distro do you have? Also can You post your whole php.ini file.

MrSako 07-11-2006 07:55 PM

im using centos like my name implies on the side

heres my php.ini

All times are GMT -5. The time now is 08:04 AM.