LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
  Search this Thread
Old 03-19-2005, 12:04 AM   #1
Juker
LQ Newbie
 
Registered: Mar 2005
Location: ph
Posts: 3

Rep: Reputation: 0
mysql test page failed!!! im running slackware 10


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 01:33 AM.
 
Old 03-19-2005, 01:07 AM   #2
CARTMAN
Member
 
Registered: Feb 2002
Location: Turkiye
Distribution: Pardus
Posts: 147

Rep: Reputation: 16
Your php build doesn't have mysql support. Grab php-mysql package for your distro.
 
Old 03-19-2005, 01:11 AM   #3
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
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 01:15 AM.
 
Old 03-19-2005, 01:44 AM   #4
Juker
LQ Newbie
 
Registered: Mar 2005
Location: ph
Posts: 3

Original Poster
Rep: Reputation: 0
thanks gbonvehi, my problem is stil there, anymore suggestion?
 
Old 03-19-2005, 02:01 AM   #5
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
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 )
 
Old 03-19-2005, 02:10 AM   #6
Juker
LQ Newbie
 
Registered: Mar 2005
Location: ph
Posts: 3

Original Poster
Rep: Reputation: 0
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?
 
Old 03-19-2005, 02:59 AM   #7
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
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 03:01 AM.
 
  


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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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