LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-11-2006, 01:12 PM   #1
MrSako
Member
 
Registered: May 2006
Distribution: CentOS 4.4
Posts: 185

Rep: Reputation: 30
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?
 
Old 07-11-2006, 01:32 PM   #2
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
Heja, what command did you give to get which error exactly?
Have you checked whether mysql is running?
 
Old 07-11-2006, 01:55 PM   #3
nickk
LQ Newbie
 
Registered: Jul 2006
Posts: 11

Rep: Reputation: 0
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?

Thanks,
Nick
 
Old 07-11-2006, 02:53 PM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
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.
 
Old 07-11-2006, 03:20 PM   #5
nickk
LQ Newbie
 
Registered: Jul 2006
Posts: 11

Rep: Reputation: 0
Code:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example:
;
;   extension=msql.so
;
; 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.
                                                                                                                            
extension=mysql.so
                                                                                                                            
;;;;
; Note: For Red Hat Linux, packaged extension modules are now loaded via
; the ini files in the directory /etc/php.d.
;;;;
You see, mysql.so is included as a module and it does exist in the extension_dir but it still doesnt work
 
Old 07-11-2006, 03:25 PM   #6
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
You should find in their an option that says something like extension_DIR. You must set that to where your modules for php reside.
 
Old 07-11-2006, 03:34 PM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
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.
 
Old 07-11-2006, 03:36 PM   #8
nickk
LQ Newbie
 
Registered: Jul 2006
Posts: 11

Rep: Reputation: 0
arrrg my extension_dir is correct, but it still deosnt work, what could it be?
 
Old 07-11-2006, 03:58 PM   #9
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
have you restarted httpd. also check to make sure your extensions are at that location. could you post your whole php.ini file.
 
Old 07-11-2006, 05:43 PM   #10
MrSako
Member
 
Registered: May 2006
Distribution: CentOS 4.4
Posts: 185

Original Poster
Rep: Reputation: 30
yes i hjave the same error

[client 24.163.113.48] 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
 
Old 07-11-2006, 05:55 PM   #11
MrSako
Member
 
Registered: May 2006
Distribution: CentOS 4.4
Posts: 185

Original Poster
Rep: Reputation: 30
ok i was given an error saying it cant find mysql.so 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 mysql.so the only result was

/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBD/mysql/mysql.so

which cant be the same mysql.so 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
 
Old 07-11-2006, 06:32 PM   #12
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
MrSako copy over that mysql.so then restart your apache web server then see if it works.

Best way is to run the following script.
Code:
<html>
<head>
<title>PHP Apache Mysql Test</title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>
It will tell you what all php has loaded.
 
Old 07-11-2006, 06:42 PM   #13
MrSako
Member
 
Registered: May 2006
Distribution: CentOS 4.4
Posts: 185

Original Poster
Rep: Reputation: 30
removed___

Last edited by MrSako; 08-06-2006 at 02:58 AM.
 
Old 07-11-2006, 07:37 PM   #14
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
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 mysql.so . 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.
 
Old 07-11-2006, 07:55 PM   #15
MrSako
Member
 
Registered: May 2006
Distribution: CentOS 4.4
Posts: 185

Original Poster
Rep: Reputation: 30
im using centos like my name implies on the side

heres my php.ini

http://pastebin.ca/85545
 
  


Reply

Tags
apache, apache2, lamp, php, php5


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A terrible trauble about linux + apache + php + mysql jiawj Linux - Software 2 06-03-2006 06:39 AM
Linux + Apache + PHP + ??MySQL/PostgreSQL?? Thakowbbery Linux - Enterprise 4 10-28-2005 03:18 PM
Linux, Apache, PHP, MySQL akilles Linux - Newbie 4 03-02-2005 02:43 AM
Linux 8.0 installed with Apache 2.0, PHP and MySQL fmagoufis Linux - Newbie 1 12-12-2002 01:13 PM
VMWare, RH Linux 7.3, Apache, MySQL and PHP xibernex Linux - Software 2 06-17-2002 09:57 AM


All times are GMT -5. The time now is 11:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration