LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-24-2003, 05:57 PM   #1
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Rep: Reputation: 30
(Resolved) Apache Mysql Php: mysql with php doesn't work


Hola

I compiled and installed the latest version of apache, mysql and php just the other day. I have just gotten around to testing to make sure that all 3 work with each other and I did this by creating:

Code:
<html>
<head>
<title></title>
</head>

<body>
<?php
 $connection = mysql_connect("localhost","root","")
 or die("sorry - unable to connect to MySQL");
 echo("Congrats - it's working");
?>
</body>
</html>
Now if all was working fine I should have seen the "Congrats" message when viewing the file saved as php on apache. I know that the apache is working and that php is working... however when trying to view that partuicular file I get an error message:

Quote:
Warning: Unknown(/usr/local/apache2/htdocs/index.php): failed to open stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening '/usr/local/apache2/htdocs/index.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0
Now unfortunately, I'm a php / mysql "know nothing" at the moment (soon to change hopefully) but I'm not sure where to go from this error. I checked the php info file and something strange I noticed is the MySQL section:

Quote:
Client API version 3.23.49
Now I know 100% that I compiled in the latest mysql which happens to be 4.0.17: so could this be my problem?

Any help really appreciated and merry christmas too

Last edited by breakerfall; 12-27-2003 at 09:00 PM.
 
Old 12-24-2003, 08:38 PM   #2
Kilka
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Mandrake, Redhat, openBSD, Gentoo
Posts: 84

Rep: Reputation: 15
php I think...

I had a problem similar to this. Did you compile php from source or use the rpm ? When you compile it from source, you have to tell it to use mysql so go ./configure --help | grep SQL and you should see something relevant.

-Kilka
 
Old 12-24-2003, 08:40 PM   #3
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
yeah... I added the relevant switch in compile to make sure it uses MySQL. The phpinfo file shows that I used the switch:
Code:
 './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql'
Any other ideas... I really want to start learning mysql and php but I need to get this thing sorted first
 
Old 12-25-2003, 01:34 PM   #4
Kilka
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Mandrake, Redhat, openBSD, Gentoo
Posts: 84

Rep: Reputation: 15
user login for the SQL server...Have

Have you already created a mySQL account for root ?

run mysql_install_db I think

-Kilka
 
Old 12-25-2003, 01:56 PM   #5
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
Thanks for the reply Kilka

I had already done this as soon as I had installed and compiled mysql. I can actually access the mysql prompt now doing /usr/local/mysq/bin/mysql -u root -p, it's just that php doesn't seem to be interacting with it. That combined with the phpinfo file showing me that the mysql version is 3.23 which is way out. :|

I guess I'm going to have to remove apache php and mysql and start over... thanks anyway
 
Old 12-27-2003, 03:48 PM   #6
Kilka
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Mandrake, Redhat, openBSD, Gentoo
Posts: 84

Rep: Reputation: 15
any luck starting over ?

Let me know if you still have issues starting over.

-Kilka
 
Old 12-27-2003, 08:59 PM   #7
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
Thanks for keeping an interest

The problem has been resolved. When I compiled php I just the switch "--with-mysql" when what I really should have done was "--with-mysql=/usr/local/mysql".. the documentation didn't make me aware of this. I noticed after deciding to re-compile php again and my console window was larger and I saw the very top bit of the end of configure message which mentioned what switch to use if I had installed mysql and didn't want to use phps own builtin mysql.

Again, thanks
 
  


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
MySQL,PHP and Apache Doug.Gentry Linux - General 4 03-26-2005 07:45 PM
Apache, MySql, PHP work on 10.0 but not 10.1 fireman949 Slackware 3 02-28-2005 11:36 PM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 08:54 PM
downloaded apache +RH mysql + RH php would it work? Red Squirrel Linux - Software 1 03-07-2004 06:11 PM
php-nuke with apache php mysql c0c0deuz Linux - Software 0 03-30-2003 06:23 AM


All times are GMT -5. The time now is 04:38 PM.

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