Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-11-2004, 06:15 PM   #1
Registered: Jun 2004
Posts: 49

Rep: Reputation: 15
Unhappy Problem installing PHP with MySQL on RedHat 9

Hi there everyone

This has been a really frustrating quagmire for me for the past week. I want to install PHP 4.3.7 and MySQL 4.0.20 on my Red Hat 9.0.

I downloaded PHP 4.3.7 from the site and installed smoothly and it worked immediately. I checked using the phpinfo() function as well. Maybe this was a bad move, since I later found out that I shouyld install MySQL first before PHP

But then, I started out using RPMs for MySQL and I rpm-ed the server tar only since I didn't think I would have needed any of the other RPMs(like devel, client) Once the server RPM was done, I could start up mysqld (not mysqld_safe) without fail and also use "mysql" to log into the database as the root and such.

Then I decided to recompile the PHP. I did "./configure --with-mysql" and didn't specify a source directory for the MySQL since I have no idea where the RPM put it. However, after re-compiling the PHP, iit is apparent that MySQL still isn't properly installed because it won't even recognize the mysql_connect() function at all.

Thus, I deciided to manually compile the MySQL package which I downloaded. I removed the server RPM and then did ./configure , make ,make install for MySQL and had it installed in the /usr/local/mysql folder. Then, I tried to re-compile PHP again this time knowing where the dam thing is , the command becomes "./configure --with-mysql=/usr/local/mysql" . Everything went well, but PHP still won't recognize the mysql_connect function afterwards!

With this manually installed MySQL 4.0.20, I can only start mysqld_safe since mysqld is nowhere in sight, and I am unable to mysql to this database even though it is apparently running in the background(show by the ps command). There is this constant error about not being able to connect with the file "mysql.sock" whenever I use the mysqladmin and mysql commands.

By the way, in the output generated by the phpinfo() function, in the sectiion "Configure Command" near the very beginning, I noticed this entry : '--with-mysql=shared,/usr' and this just dosn't bode well.

Can someone please tell me how I can rectify these problems? Should I reinstall Red Hat and then work everything out again from scratch? Just wondering if anyone has had problems like this before with MySQL 4.0.20 and PHP 4.3.7. I am pretty sure that Apache is working fine and it came installed with Red Hat 9

Thank you!
Bewildered and confused MySQL and PHP newb
Old 07-11-2004, 06:58 PM   #2
LQ Guru
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Okay firstly for an RPM install in order to compile anything with mysql support you need the devel packages. Also I would suggest that you stick with RPMs whenever possible, avoid mix and match source and rpm installs that depends on each other.
Undo what you've done, uninstall the MySQL and PHP source install, reinstall the official MySQL rpms, including the -devel packages. Now grab the latest PHP source rpm from Fedora development branch:
compile it using
rpmbuild --rebuild php-4.3.7-4.src.rpm
If it complains about dependencies you have to satisfy them. Once it's done you should see a bunch of rpms in /usr/src/redhat/RPMS/i386, install them all since that's how the PHP package is managed in Redhat/Fedora and you should be good to go. Of course the same method can apply to any other package, the fedora development branch has pretty much the latest packages, and SRPMs are a good way to keep older RPM based distros up to date.


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
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 09:54 PM
Installing MySQL.4.0.17 and php support for Mysql on RedHat 9.0 Neha Linux - Software 13 12-29-2003 01:06 AM
Help Installing MySql, Apache and PHP for RedHat 8 rmedina Linux - Newbie 2 10-18-2003 06:36 PM
Redhat linux 9 - PHP & MySQL problem :Pengy: ali_zahid Linux - Software 4 07-15-2003 11:24 AM
Redhat linux 9 - PHP & MySQL problem ali_zahid Programming 3 07-02-2003 01:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:43 PM.

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