|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Connecting to Postgresql via php with Apache chrooted (openBSD)
I have installed php and postgresql on OpenBSD. the default install of Apache does a chroot shortly after startup. If I run it chrooted then I can't connnect to postgres.
I suspect it is because it needs to write to /tmp but why would it not be writing as the postgresql user instead of www. has anyone else had this issue, how did you solve it. Thanks for any help. |
|
#2
|
|||
|
|||
|
1. you need a "/tmp" in your chrooted directory. make it mode 1777 (rwxrwxrwt).
2. mod_php always runs as the user the www server is running as ("www"). you can use PHP as cgi and use the suexec mechanism of apache ( http://httpd.apache.org/docs/suexec.html ) to run it as another user. why do you need /tmp for access to postgres? is php trying to connect to postgres via a named pipe? (aka is there a file "/tmp/postgres.sock" that is used to communicate with prostgres?) - i donīt know it, but mysql does use this way... then forget everything above and make php connect to your database via sockets instead, i.e. connect to "localhost".
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
|||
|
|||
|
Thanks.
I found an command-line option to pass to postgresql startup that changes the unix-socket location. I think that will work. furthur, is it a real advantage to run it chRoot'ed? It doesn't do that on linux. |
|
#4
|
||||
|
||||
|
If you set httpd_flags in /etc/rc.conf to -u, then OpenBSD won't chroot Apache.
|
|
#5
|
|||
|
|||
|
the chroot() mechanism is a quite good security measure to protect the other parts of your system after apache got hacked...
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > BSD Help > Connecting to Postgresql via php with Apache chrooted (openBSD) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|