LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-14-2009, 11:02 AM   #1
Mr. Long
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Rep: Reputation: 0
Php & SQL


Ok I have a server with Apache2, PHP 5, and SQL 5.

I cannot get it to connect to the SQL server via PHP, and phpinfo() isnt showing SQL.

I have taken out the ; extension=mysql.so, in the php.ini. i have also verified that the extension dir is correct. and restarted the server. Any other ideas??
 
Old 01-14-2009, 10:17 PM   #2
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Rep: Reputation: 31
Can we get some more information? Distribution? Were they compiled or installed as packages? What type of SQL?

Also, verify that SQL is working. In MySQL, you just use the mysql command and enter your username and password...

--scott
 
Old 01-15-2009, 08:36 AM   #3
Mr. Long
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Fedora Core 6, mysql, yes SQL is working i have already made a database. as far as compiled or installed as packages i dont know cause i didnt install them
 
Old 01-15-2009, 10:02 AM   #4
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Rep: Reputation: 31
Alright, cool. Can you post the PHP script you're using to attempt to connect? I haven't had FC6 installed on a system for a while, but my F10 box doesn't have an extension entry in the php.ini for mysql. Also, you may want to try looking into your error log for apache

--scott
 
Old 01-15-2009, 03:09 PM   #5
Mr. Long
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
<?php
$link = mysql_connect('192.168.0.5', 'usr', 'passwd') or die('Could not connect: ' . mysql_error());result($result);
?>

i have also tried localhost where the ip is

i have looked at the apache logs but the last error it shows was from 2 months ago (unless i am looking at the wrong log)

i have also tried phpMyAdmin and it says there is an error loading mysql, and to check php.ini..
 
Old 01-15-2009, 03:26 PM   #6
Mr. Long
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Ok i was looking at the wrong log, i have some errors, the mysql fatal error but that hasnt been showing anymore it is just a blank white screen now
 
Old 01-15-2009, 03:32 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by Mr. Long View Post
Ok i was looking at the wrong log, i have some errors, the mysql fatal error but that hasnt been showing anymore it is just a blank white screen now
Well, yeah....all your php script is doing is connecting to the database. You're not doing anything else, so what would you expect to see, other than a white screen???

Put some output in there...run a query or two, and print the results. Check the connection and echo back "Yes I connected!", and you'll see something.
 
Old 01-15-2009, 03:57 PM   #8
Mr. Long
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
Well, yeah....all your php script is doing is connecting to the database. You're not doing anything else, so what would you expect to see, other than a white screen???

Put some output in there...run a query or two, and print the results. Check the connection and echo back "Yes I connected!", and you'll see something.
i used this code i found online (i dont know anything about php or sql)
<?php
$link = mysql_connect('localhost', 'usr', 'pass');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

and still white screen
 
Old 01-16-2009, 08:16 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by Mr. Long View Post
i used this code i found online (i dont know anything about php or sql)
<?php
$link = mysql_connect('localhost', 'usr', 'pass');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

and still white screen
Ok...have you check the Apache and/or PHP logs? Are you getting any errors???
 
Old 01-16-2009, 09:05 AM   #10
Mr. Long
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
in the logs all i get is

sysname - - [16/Jan/2009:09:03:44 -0600] "POST /webpath HTTP/1.1" 200 -

in apache2 logs not php...there isnt anything in the php log

Last edited by Mr. Long; 01-16-2009 at 09:15 AM.
 
  


Reply



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
PHP and ms-SQL joelhop Programming 2 11-22-2006 08:45 AM
Php, Sql kotoisin Fedora 3 11-30-2004 05:18 PM
can not connect to sql with php gkaffen338 Linux - Newbie 5 04-22-2004 11:36 AM
php/SQL shaggystyle Linux - General 1 12-23-2003 09:29 AM
PHP & my SQL Z28kid Linux - General 2 04-20-2003 11:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration