LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Thread Tools
Old 03-19-2005, 01:04 AM   #1
Juker
LQ Newbie
 
Registered: Mar 2005
Location: ph
Posts: 3
Thanked: 0
mysql test page failed!!! im running slackware 10


[Log in to get rid of this advertisement]
nid some help!!!

im running a slackware 10.0 with apache 1.3, php 4.3 and mysql 4.0. i got this error when i tried to test a simple php script and mysql:

<html>
<title> can u see this! </title>
<body>

<?php
$conn = mysql_connect("localhost", "root", "xxx");

$create_success = mysql_create_db("testdbx");
if($create_success)
echo("<b><font color=\"blue\">create database: success!</font></b><br>");

mysql_select_db("testdbx",$conn);

$sql = "CREATE TABLE testTable (id int not null primary key auto_increment,

testField varchar (75))";

$result = mysql_query($sql, $conn) or die(mysql_error());

echo $result;
mysql_close();

?>
</body>
</html>

my apache error logs:
[Sat Mar 19 13:47:16 2005] [error] PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) in /var/www/htdocs/t.php on line 6
[Sat Mar 19 13:47:16 2005] [error] PHP Fatal error: Call to undefined function: mysql_create_db() in /var/www/htdocs/t.php on line 8
[Sat Mar 19 13:48:17 2005] [error] PHP Fatal error: Call to undefined function: mysql_create_db() in /var/www/htdocs/t.php on line 8
[Sat Mar 19 13:49:11 2005] [error] PHP Fatal error: Call to undefined function: mysql_create_db() in /var/www/htdocs/t.php on line 8


but using:
mysql -u root -p
>my password
mysql>
mysql> use mysql
Database changed
mysql> show tables;
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv |
| db |
| func |
| host |
| tables_priv |
| user |
+-----------------+
6 rows in set (0.00 sec)

mysql>

wats wrong? any help wud be appreciated, tenks!!!

Last edited by Juker; 03-19-2005 at 02:33 AM..
Juker is offline     Reply With Quote
Old 03-19-2005, 02:07 AM   #2
CARTMAN
Member
 
Registered: Feb 2002
Location: Turkiye
Distribution: Pardus
Posts: 147
Thanked: 0
Your php build doesn't have mysql support. Grab php-mysql package for your distro.
CARTMAN is offline     Reply With Quote


Old 03-19-2005, 02:11 AM   #3
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,138
Thanked: 0
CARTMAN: That's not true, the function is declared so it's built with MySQL support.

Juker: Check the /etc/my.cnf file (or whereever you've your config file) and see if you have something like
Code:
[mysqld]
socket          = /var/run/mysql/mysql.sock
and a line that says
Code:
skip-networking
without being commented.
Oh by the way, try making another user, root has too many permissions

Last edited by gbonvehi; 03-19-2005 at 02:15 AM..
gbonvehi is offline     Reply With Quote


Old 03-19-2005, 02:44 AM   #4
Juker
LQ Newbie
 
Registered: Mar 2005
Location: ph
Posts: 3
Thanked: 0

Original Poster
thanks gbonvehi, my problem is stil there, anymore suggestion?
Juker is offline     Reply With Quote


Old 03-19-2005, 03:01 AM   #5
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,138
Thanked: 0
I'm not trying to offend you, but if /var/run/mysql/mysql.sock exists. (Many people get offend with this kind of questions but sometimes it happens )
gbonvehi is offline     Reply With Quote


Old 03-19-2005, 03:10 AM   #6
Juker
LQ Newbie
 
Registered: Mar 2005
Location: ph
Posts: 3
Thanked: 0

Original Poster
its ok.

if im working from the console, mysql is fine. wats the problem, the mysql.sock is also there!

gbonvehi, after installing mysql is there any configuration i need to do in order for mysql to work with php? or do u know some links (tutorial) for this?
Juker is offline     Reply With Quote


Old 03-19-2005, 03:59 AM   #7
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,138
Thanked: 0
There are plenty of tuturials and A&Q (here in LQ), do this, create a file, let's say: test.php and put inside:
Code:
<?
phpinfo();
?>
Put it somewhere on your webserver and access to it, there you'll see if PHP is configured right.
çç

Last edited by gbonvehi; 03-19-2005 at 04:01 AM..
gbonvehi is offline     Reply With Quote



Reply

Bookmarks


Thread Tools

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
test page web regnier General 9 03-01-2005 07:49 AM
I cant change the default test page in apache server to add my page.y nhemapriya Linux - Newbie 3 05-13-2004 01:35 PM
Sorry, that Apache test page is at it again. Hal Linux - Newbie 4 10-26-2003 06:53 PM
MySQL...failed test suite. jimmytango829 Linux - Software 1 12-02-2002 02:09 AM
care to test a page for me? please! acid_kewpie General 12 12-01-2002 06:48 PM


All times are GMT -5. The time now is 09:25 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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration