Upgrade to 5.0 from 4.x broke Apache+PHP's ability to talk to mysql.sock

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Upgrade to 5.0 from 4.x broke Apache+PHP's ability to talk to mysql.sock

Damon Getsman
Whoops; sent this earlier, but I hadn't changed the message
subject from the Message Digest default text.  I assume that's
why it wasn't forwarded previously.  Here's what I'd written on
this subject previously:

Awhile back here, I brought up an issue that occurred when I was
upgrading my system from OpenBSD 4.x to 5.0.  I'm not sure if it was
on this mailing list or not, but this seems like the most appropriate
place to bring it up.

I had relied on several services via Apache that utilize PHP & MySQL
in a fairly standard configuration.  Unfortunately, when I upgraded
(all according to the standard upgrade instructions provided), all of
my services broke due to PHP not being able to connect to the sock
located in '/var/run/mysql/mysql.sock'.  I asked for help and googled
like a fiend for awhile, but even when interactively talking to folks
in freenet's #openbsd, I was unable to find what might've been wrong
with this.

Foolishly enough, several times I considered the fact that httpd would
be executing everything in the chroot jail of '/var/www', but I didn't
research it that deeply or try moving the sock, because I figured that
with all of the people I spoke to already, certainly one of the
experts would have mentioned if this had been causing an issue or not.

Last night, however, when I decided to take another stab at things,
googling turned up a result that I hadn't seen previously (I am
google-tarded, so I will accept the possibility that I'd not done as
straightforward an attempt to look for the answer of this issue as I'd
thought).  The link was at
http://philihp.com/blog/2008/connecting-to-mysql-with-php-in-apache-on-openbsd/
(2008?  Certainly I must not have googled as well as I thought!), and
referred to a permanent (although kludgy) solution found at
http://www.openbsdsupport.org/e107_CMS.html .

The solution was, indeed, dealing with creating a hardlink to
somewhere within the chroot'ed jail; in this case under
/var/www/var/run/mysql/mysql.sock after the appropriate path was
created.

Anyway I just thought that I'd post that here, since a lot of people
in the OpenBSD community didn't seem to know how simple the solution
really was or where it might be found at.  It might be a good idea to
toss this in the 4.x to 5.0 upgrade instructions, as well.  It seems
like a relatively simple oversight.

Best wishes.

-Damon

Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to 5.0 from 4.x broke Apache+PHP's ability to talk to mysql.sock

Liviu Daia-2
On 12 August 2013, Damon Getsman <[hidden email]> wrote:
[...]

> Last night, however, when I decided to take another stab at things,
> googling turned up a result that I hadn't seen previously (I am
> google-tarded, so I will accept the possibility that I'd not done as
> straightforward an attempt to look for the answer of this issue as I'd
> thought).  The link was at
> http://philihp.com/blog/2008/connecting-to-mysql-with-php-in-apache-on-openbsd/
> (2008?  Certainly I must not have googled as well as I thought!),
> and referred to a permanent (although kludgy) solution found at
> http://www.openbsdsupport.org/e107_CMS.html .
>
> The solution was, indeed, dealing with creating a hardlink
> to somewhere within the chroot'ed jail; in this case under
> /var/www/var/run/mysql/mysql.sock after the appropriate path was
> created.
[...]

    Please, stop repeating this nonsense.  This "solution" works until
you restart the server manually, since mysqld removes the socket before
re-creating it.

    The real solution is either to use TCP connections, or move the
socket inside the jail and make /etc/my.cnf and /var/www/etc/my.cnf
point to it accordingly.

    Regards,

    Liviu Daia