LinuxQuestions.org
Help answer threads with 0 replies.
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 05-23-2004, 02:16 PM   #1
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
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!
 
Old 05-24-2004, 01:21 AM   #2
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Leave out the --with-mysql. You shouldn't need to recompile Apache unless it has previously been compiled without the --enable-so option.
 
Old 05-24-2004, 07:30 AM   #3
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
Hi, thanks for the response. Here is what I get from the configure script:

Code:
+--------------------------------------------------------------------+
|                        *** WARNING ***                             |
|                                                                    |
| You will be compiling the CGI version of PHP without any           |
| redirection checking.  By putting this cgi binary somewhere in     |
| your web space, users may be able to circumvent existing .htaccess |
| security by loading files directly through the parser.  See        |
| http://www.php.net/manual/security.php for more details.           |
+--------------------------------------------------------------------+
So this means that it will not be running as a DSO, correct? Does that mean that Apache was previously compiled without DSO supprt, or does it mean that I need to include the --with-apxs option?

Thanks again.
 
Old 05-24-2004, 06:00 PM   #4
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Quote:
Originally posted by zaichik
or does it mean that I need to include the --with-apxs option?
Yeap. Or --with-apxs2 if you're using Apache 2.
 
Old 05-24-2004, 06:07 PM   #5
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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!
 
Old 05-24-2004, 07:00 PM   #6
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
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?
 
Old 05-24-2004, 09:49 PM   #7
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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!
 
Old 05-25-2004, 02:54 AM   #8
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
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.
 
Old 05-25-2004, 06:14 AM   #9
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
Do you know whether it is compiled as an Apache DSO?
 
Old 05-25-2004, 06:55 AM   #10
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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!
 
Old 05-25-2004, 07:11 AM   #11
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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?

Last edited by zaichik; 05-25-2004 at 07:14 AM.
 
Old 05-25-2004, 08:39 AM   #12
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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!
 
Old 05-25-2004, 08:45 AM   #13
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
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!
 
Old 05-25-2004, 09:42 AM   #14
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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
warning: php-mysql-4.3.3-6.i386.rpm: V3 DSA signature: NOKEY, key ID 4f2a6fd2
error: Failed dependencies:
        libmysqlclient.so.10 is needed by php-mysql-4.3.3-6
[root@linux root]#



Thanks.
 
Old 05-25-2004, 10:26 AM   #15
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Original Poster
Rep: Reputation: 30
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
[root@linux root]# slocate -u
[root@linux root]# slocate libmysqlclient
/usr/lib/libmysqlclient.so.10
/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so.10.0.0
[root@linux root]# rpm -i php-mysql-4.3.3-6.i386.rpm
warning: php-mysql-4.3.3-6.i386.rpm: V3 DSA signature: NOKEY, key ID 4f2a6fd2
[root@linux root]# /usr/sbin/apachectl restart
Guess what--no joy!

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


Reply


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
What to type in apt-get install to install mysql PHP libraries sarajevo Debian 1 09-29-2005 05:40 AM
confused on php and Mysql install spedsta Linux - Software 3 11-05-2004 01:36 PM
MySQL 4 on Fedora can't install php-mysql kennyg Linux - Software 8 09-21-2004 06:54 PM
MySql-Php install PatC Linux - Newbie 4 07-02-2002 11:36 AM
How to install php and mysql supersunny Linux - Software 1 09-04-2001 10:28 AM


All times are GMT -5. The time now is 03:02 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