I have the php app Gallery, a php web based based photo gallery
running and that works fine.
mysqld is running and I can login through the CLI and use the db
'mysql' with root or with my superuser, so that's OK. All that seems
to have transfered over from upgrading the OS without a hitch. All I
did was restart Mysql. Php was already turned on in httpd this time
around, iirc. Test php info script work as well.
But when I try to connect to mysql with this script I can't connect:
<?php
$server = "localhost:/var/mysql/mysql.sock";
$user="mysuperuser";
$password="mypassword";
$db = "mysql";
mysql_connect($server, $user, $password);
mysql_select_db($db);
echo mysql_error();
phpinfo();
?>
I get these:
Warning: mysql_connect(): Can't connect to local MySQL server through
socket '/var/mysql/mysql.sock' (13) in /Library/WebServer/testpad/
test.php on line 3
Warning: mysql_select_db(): Can't connect to local MySQL server
through socket '/tmp/mysql.sock' (2) in /Library/WebServer/testpad/
test.php on line 3
Warning: mysql_select_db(): A link to the server could not be
established in /Library/WebServer/testpad/test.php on line 3
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Checking mysqladmin shows this var/mysql/mysql.sock.
All this is running on the same machine I'm sitting at.
Thanks for any and all tips, remember I'm an amateur. :)
Gil
On May 29, 2005, at 2:27 AM, Michael Stassen wrote:
You haven't given us much to go on, other than "it doesn't work,"
which isn't really helpful. We can't give you "specific ideas
where to look" until you give us specific details of what's wrong.
Please describe what happens. Do you get an error message? What
is it? While you're at it, show us the relevant lines of code
(hide the password, of course).
You say mysql, php, and apache are working separately. I take it
that php scripts are running via web access (apache)? I ask
because some previous Mac OS upgrades replaced the apache config
with a newer one with php turned off.
Meanwhile, the Apache user is irrelevant. The php script just
needs a valid *mysql* user and password to authenticate.
"bounce" = restart
Michael
[EMAIL PROTECTED] wrote:
From your first message below, are you suggesting a setting in
Apache needs to be ticked?
I can do it if I know where to look. I am no expert, just one
who uses tis setup, i.e., "it just works." I have used the
previous version for years and it "just worked." That's why I
have no idea what could possibly be different.
Not to say I haven't built these before, but this should be
working! :(
What's led me to this problem is that I have phpmyadmin installed
and it can't access mysql as it could just fine before.
I have had help from the guys at phpmyadmin who have no sent me
here. No one "gets it."
So, any specific ideas where to look???
Thanks,
Gil
p.s. I don't know what you mean by "bounce the MYSQL DB."
On May 28, 2005, at 9:47 PM, sol beach wrote:
I don't do MACs, but here is a shot in the dark.
In some/many cases Apache gets invoke as user "nobody";
which would be the the "OS user" that needs to be granted access
to MYSQL.
I'm willing to bet that the failure to connect into MYSQL via PHP
from
Apache is due
to a permissions/login/authorization issue.
You also wrote:
If you enable LOGGING & bounce the MYSQL DB, some clue about what
is or is not
happening to MYSQL will be written to the logfile.
Discern what the clues are reporting and fix the problem.
HTH & YMMV
On 5/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I'm on Mac OSX and Mysql is built-in, so is php.
My php has built-in support for mysql.
Both php and mysql are up and running. I have tested both. All
this
is running on this machine, so is Apache.
I can log into mysql at the CLI with my superuser and access the
'mysql' db -the only one I currently have.
I have a good php test connect script but cannot connect to mysql.
I have checked the mysql variables and entered the socket location
into the script, no help.
What else can possibly be wrong? Is there something in a mysql
config file or something that is off?
This is an upgrade install of Mac OSX 10.4 Server over 10.3 Server
(I'm not a wiz) but have used it long enough. I have changed
nothing
and it worked fine before.
Any suggestions? Again, I did not build this it's all built-in and
working fine. I simply can't connect with php. Separately, mysql
and php both work.
Thanks,
Gil