[nycphp-talk] Re: can connect to MySQL from command line, but not from script
David Mintz
david at davidmintz.org
Tue Nov 20 15:44:58 EST 2007
'tail /var/log/messages' outputs the hot tip to run sealert which
tells you flat out: '/usr/sbin/setsebool -P
httpd_can_network_connect=1'
Solved. You guys are the greatest!! (-:
On Nov 20, 2007 3:34 PM, David Mintz <david at davidmintz.org> wrote:
> Wait a second. When invoked from the command line, PHP can do it:
>
> [root at interps1 test]# php test.php
> alleluyah
>
> But not when Apache runs same code -- ah, we have one of those SELinux
> issues, don't we?
>
>
> On Nov 20, 2007 3:30 PM, David Mintz <david at davidmintz.org> wrote:
> > I just installed CentOS 5 and I need to connect to a MySQL server on
> > another box. I can do it from the command line but not from PHP. These
> > old scripts use PEAR DB. Thus:
> >
> > mysql -utestuser -psecret -hinterps2 test
> >
> > Your MySQL connection id is 20491 to server version: 5.0.17-standard-log
> > mysql>
> >
> > But:
> > <?php
> > require 'DB.php';
> > $DSN = "mysqli://testuser:secret@interps2/test" ;
> > $db = DB::connect($DSN);
> >
> > if (PEAR::isError($db)) {
> > echo $db->getDebugInfo();
> > } else {
> > echo "alleluyah\n" ;
> > }
> >
> > Output:
> >
> > [nativecode=Can't connect to MySQL server on 'interps2' (13)] **
> > mysqli://testuser:secret@interps2/test
> >
> > I wish to hell it would tell me why not. Anyone have any ideas where
> > to look for more information?
> >
> > Thanks,
> >
> > --
> > David Mintz
> > http://davidmintz.org/
> >
> > The subtle source is clear and bright
> > The tributary streams flow through the darkness
> >
>
>
>
> --
> David Mintz
> http://davidmintz.org/
>
> The subtle source is clear and bright
> The tributary streams flow through the darkness
>
--
David Mintz
http://davidmintz.org/
The subtle source is clear and bright
The tributary streams flow through the darkness
More information about the talk
mailing list