LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem installing PHP with MySQL on RedHat 9 (https://www.linuxquestions.org/questions/linux-newbie-8/problem-installing-php-with-mysql-on-redhat-9-a-203831/)

d2army 07-11-2004 05:15 PM

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 php.net 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

Demonbane 07-11-2004 05:58 PM

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:
http://distro.ibiblio.org/pub/linux/....3.7-4.src.rpm
compile it using
Code:

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.


All times are GMT -5. The time now is 01:50 AM.