PHP install --with-mysql
Hi, I want to install PHP with MySQL support.
I am running Fedora Core 1 and using the version of Apache that it installs (2.0.47), and have installed MySQL 4.0.18-standard from an RPM. I am preparing to install PHP 4.3.6 from source but have some questions. My understanding is that I want to install PHP as an Apache DSO. In order to do that, I need to configure PHP using the option --with-apxs=/path/to/apxs. The problem is that I don't seem to have apxs. If I understand correctly, apxs is included with the development version of Apache, and that is not the one that is installed by FC1 installation. Is there some other way to get this script? I have searched high and low and cannot seem to find it. Secondly, I want to--of course--enable MySQL support. I tried this on another box (and it didn't go too well). When I tried ./configure --with-mysql=/usr/bin it complained that it could not locate the mysql header files. Now this makes sense that I do not have the header files, since I installed MySQL from an rpm and not from source. But I have a source that states that "If you do not specify a directory, the bundled MySQL library will be used." (http://hotwired.lycos.com/webmonkey/...tw=programming) So would my line be ./configure --with-mysql, or would I leave out --with-mysql altogether? To sum up my question, how can I install PHP as an Apache DSO without reinstalling Apache from source, and include MySQL support when I installed it from an rpm? Thanks in advance! |
Leave out the --with-mysql. You shouldn't need to recompile Apache unless it has previously been compiled without the --enable-so option.
|
Hi, thanks for the response. Here is what I get from the configure script:
Code:
+--------------------------------------------------------------------+ Thanks again. |
Quote:
|
I am using Apache 2, but I have neither apxs nor apxs2. I read somewhere that apxs comes with a developer installation of Apache (?) and that is apparently not what is installed with Fedora Core 1. At any rate, I don't have it and can't seem to find how to get it. I'm not really interested in this point at reinstalling Apache from source if there is *any* other way.
Thanks! |
Installing it from source is really no big deal, but if you're dead against it, why don't you just install the Fedora PHP rpm?
|
Hi miknight,
Thanks for all your help, really. I love this forum! :) Initially I did have PHP installed from Fedora. What set me off on this path was when I started my first web app on this box using PHP. I had this line: $conn = mysql_connect( "localhost", "user", "pass" ); and I got some error about "call to unknown function" or some such. For whatever reason, PHP installed without MySQL support. So I'm thinking that the Fedora PHP rpm wouldn't be the solution. While installing Apache from source is no big deal, I was unable to do it in such a way that everything works the way it does in a "normal" install. I have run through this whole process before on another box, and while I believe I have it working (finally), there are a number of problems, all of them dealing with the way I installed Apache. Apache no longer starts automatically on a reboot; /etc/init.d/httpd is gone; the conf file is not where I am accustomed to having it (now in /usr/local/apache/bin/httpd.conf or some such) and so forth. Perhaps there is another rpm somewhere that would install PHP with MySQL support? That sounds like the ticket...What do you think? Thanks again! |
Hmmm well from my experience Red Hat compiles their PHP RPM with just about everything bundled with it - certainly with MySQL support. I think the easiest option would be to install the Apache, PHP and MySQL RPMs from your Fedora CD and try debugging that setup.
|
Do you know whether it is compiled as an Apache DSO?
|
OK, reinstalled PHP with the Fedora rpm. I am now back to this error:
Fatal error: Call to undefined function: mysql_connect() in /var/www/html/index.php on line 8. Now, looking through the output from phpinfo(), I see this in the section on configure command: --with-mysql=shared, /usr Further, the section dbx lists supported databases, and MySQL is the first in the list. So it seems that PHP supports MySQL, but for some reason is not recognizing the mysql functions. Do I need to take this post somewhere else? Thanks for the help! |
One more thing, also in the phpinfo() output in the section on the configure command is this:
--with-apxs2=/usr/sbin/apxs As I mentioned earlier in the thread, I was unable to find apxs on my machine, and it is not in /usr/sbin unless it is hidden or something. If the line above was successful, then PHP would have compiled as a DSO, and then I would need a LoadModule directive in httpd.conf in order for PHP to work (as I understand it). The directive is not there, and PHP is working (just doesn't recognize mysql functions), so it must not be a DSO? |
The answer
It appears that when installing from rpms, you have to also install the php-mysql rpm:
http://www.phpbuilder.com/board/show...7#post10515397 So that is my new struggle. I will carry this on at phpbuilder.com Thanks to everyone for the help! |
No it would be a DSO. The fact that you can't find the apxs2 file doesn't matter. As long as it's there when PHP compiles (which is taken care of by Red Hat) then it's fine. Your error seems kind of strange. As you can imagine the Fedora RPM's are designed to play well with each other, so I'm surprised it doesn't work by default.
After doing a bit of research it looks like you need to install an RPM called php-mysql (http://www.redhat.com/archives/fedor.../msg00439.html). For Fedora core 1 it will probably be php-mysql-4.3.3-6.i386.rpm or something. Remember to service httpd restart after installing it. If you have in fact already installed this RPM then I think I'm out of ideas! :) |
Hi miknight,
I tried to install it, but got the following error: Code:
[root@linux root]# rpm -i php-mysql-4.3.3-6.i386.rpm :scratch: Thanks. |
Update:
Turns out that libmysqlclient.so10 comes with an older version of MySQL (3.something). So I had to install the shared libraries from MySQL-shared libraries. Fair enough: Code:
[root@linux root]# rpm -i MySQL-shared-3.23.37-3.i386.rpm Fatal error: Call to undefined function: mysql_connect() in /var/www/html/index.php on line 8 <sigh /> I'm about to give up here.... |
All times are GMT -5. The time now is 06:32 AM. |