Re: php cli and mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm behind on this list because we just finished up the 9th Annual
Jeff Buckley Tribute...

Anyway, wanted to clarify a mis-statement here, that nobody else
really seemed to clearly define...

On Tue, November 14, 2006 5:56 pm, Tom Ray [Lists] wrote:
> Roman Neuhauser wrote:
>> # cajbecu@xxxxxxxxx / 2006-11-14 20:17:16 +0200:
>>
>>> On 11/14/06, James Tu <jtu@xxxxxxxxxxxxx> wrote:
>>>
>>>> I'm running a php script from the command line (I'm on OS X) and
>>>> I'm
>>>> getting ...
>>>>
>>>> Warning: mysql_connect(): Can't connect to local MySQL server
>>>> through
>>>> socket '/var/mysql/mysql.sock' (2)
>>>>
>>> touch /var/mysql/mysql.sock
>>> chmod 777 /var/mysql/mysql.sock
>>>
>>
>>     How could that possibly help?
>>
> Because if the mysql.sock file is missing the mysql server won't
> start.

That is not correct.

When MySQL starts, it will create this file IF IT CAN.

If you have some user other than 'root' starting up mysql, and if that
user cannot create files in /var/mysql, then your "solution" would
kinda sorta "work" by root forcing a file to exist that MySQL had
tried, and failed, to create...

> If the mysql server isn't running the PHP script won't work. So I
> think
> it helps a lot.

Using 'touch' to create the file is almost-for-sure a Bad Idea.

Using chmod to be sure that both the user running the mysql process
the user running the web process can both read/write that file is
probably a correct solution for cases where the file creation was not
done correctly.  Though I'm not sure 777 is the Best Answer...  You'd
have to research that for yourself.

Of course, none of this applies at all to the situation of the OP, nor
of Apple's documented issue of having the mysql.sock file in the wrong
place.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux