1. Apache / PHP4 / MySql Problem - Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock'
I have a fresh installation of OpenBSD 3.2. I have not made any
alterations to the base installation. I enabled Apache via rc.conf
and tested (I also enabled server-status & server-info in httpd.conf).
I installed PHP4 from the packages tree at 3.2/Packages. I configured
according to the instructions at webmonkey and tested with phpinfo().
I integrated with Apache and tested with the sample php3 script shown
below:
<html>
<body>
<?php
$myvar = "Hello Adam";
echo $myvar;
?>
</body>
</html>
which worked fine. (Returned "Hello Adam")
I then installed mysql from the package currently in 3.2/Packages with
its supporting packages (p5-DBD-1.30, mysql-client-3.23.54,
p5-DBD-Mssql-Mysql-1.22.19, libiconv-1.8, gettext-0.10.40 and
recode-3.6). I enabled MySQL to start at reboot using the
instructions at http://www.hostbaby.com/misc/mysql-openbsd.html.
After a reboot, mysql starts on port 3306 w/a PID of 8643. I set the
password, created a test database and verified the functionality of
the base databases.
I added the php4-mysql-4.2.3 package to enable integration with MySql
and verified that phpinfo() returns MySQL integration successfully,
which it does.
I prepared the following script in /var/www/htdocs (named test2.php3):
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
?>
</body>
</html>
When I open my browser to http://target_Svr/test2.php3, I get the
following
Warning: Can't connect to local MySQL server through socket
'/var/run/mysql/mysql.sock' (2) in /htdocs/test2.php3 on line 7
Warning: MySQL Connection Failed: Can't connect to local MySQL server
through socket '/var/run/mysql/mysql.sock' (2) in /htdocs/test2.php3
on line 7
Warning: mysql_select_db(): supplied argument is not a valid
MySQL-Link resource in /htdocs/test2.php3 on line 9
Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /htdocs/test2.php3 on line 11
Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /htdocs/test2.php3 on line 13
First Name:
So, I rolled over to /var/run/mysql and noticed that mysql.sock did
exist with filesize 0.
I have been searching and working on this for over a week, any help
would be greatly appreciated. Top it off, its for a non-profit org
that I decided to help out.. so its a good cause.
2. What's the best open source architecture for thin client (web) apps?
3. start mysql database as mysql instead of root
4. VLB EIDE Controller Card with Enhanced BIOS
5. Can't connect to local MySQL server through socket '/tmp/mysql.sock'
6. 'linux' : unknown terminal type
7. mysql with c, cant find declaration of mysql-functions...
8. Source Code Configuration Management
9. Can't connect to local MySQL server through socket '/tmp/mysql.sock'
10. mySQL: where is mysql-server.sh?
11. Mysql and Mysql.pm
12. Only user "root" and "mysql" can connect to mysql?
13. PHP/MySQL "mysql.sock" not found ???