LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   mysql test page failed!!! im running slackware 10 (https://www.linuxquestions.org/questions/programming-9/mysql-test-page-failed-im-running-slackware-10-a-303425/)

Juker 03-19-2005 12:04 AM

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

CARTMAN 03-19-2005 01:07 AM

Your php build doesn't have mysql support. Grab php-mysql package for your distro.

gbonvehi 03-19-2005 01:11 AM

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 ;)

Juker 03-19-2005 01:44 AM

thanks gbonvehi, my problem is stil there, anymore suggestion?

gbonvehi 03-19-2005 02:01 AM

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 ;) )

Juker 03-19-2005 02:10 AM

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?

gbonvehi 03-19-2005 02:59 AM

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


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