[PHP-INSTALL] PHP & Apache2 on OpenBSD

2004-02-05 Thread r . php
Hello people,

Problem ! (aren't they all ?)

I'm trying to get PHP working with Apache 2 on OpenBSD. Apache 2 is not
 supported in the OpenBSD ports so I figured I'd just build it from the
 standard source distribution. I've done this on Linux and it's never caused
 me a problem.

I have used exactly the same configuration on the OpenBSD build that I have
 used on Linux.

I build Apache with...

> ./configure --prefix=/usr/local/apache2 --enable-ssl
 --with-ssl=/usr/src/openssl/openssl-0.9.7 -enable-mods-shared="libphp4"
 -enable-modules="access dir mime mime_magic log_config alias negotiation setenvif"
> make
> make install

...and I build PHP with...

> ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php
 --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars
 --enable-magic-quotes --enable-debugger --with-mysql=/usr/lib
 --enable-inline-optimization --without-pear
> make
> make install

There's no hint of a problem with either build and sure enough, Apache runs
 fine on its own and serves pages with no problems.

But if I try and load the libphp4.so module with...

LoadModule php4_modulemodules/libphp4.so

...I get nothing !

I try and start apache and it just returns. No tasks, no error log, no core
 dump, nothing. Absolutely no indication why it fails. And before you ask,
 yes, all the file permissions are fine - I get error logs when I don't load
 libphp4.so and I've made sure the core dump directory is writable etc etc.

I can load other modules with no problems; I re-jigged the apache config to
 build 'access' as a module and load this with...

LoadModule access_module  modules/mod_access.so

...and it works fine.

If I try and syntax check the config file with the PHP 'LoadModule' line in
 (with /usr/local/apache2/bin/httpd -t), it doesn't even return a 'Syntax Ok'
 message. If I comment out the PHP 'LoadModule' line, I do. If I start apache
 with the PHP Loadmodule line commented out and then comment the line back in
 and try and stop apache, it ignores me and carries on running ! It looks like
 just having the LoadModule php4... line in the config file is killing the
 apache startup/shutdown stone dead. But I know this doesn't make sense, so it
 MUST be something to do with the PHP module itself... mustn't it ?

The apache config file I'm using is one I've used for ages on Linux and I'm
 sure it's absolutely fine. If I strip it down to the bare minimum, PHP will
 still fail to load. Here's such a config file that I've tried...

# Apache 2 config
ErrorLog logs/error_log
LogLevel debug
ServerRoot "/usr/local/apache2"
User httpd
Group httpd
PidFile logs/httpd.pid
# This next line works fine
LoadModule access_module  modules/mod_access.so
# This next line is causing me grief !
LoadModule php4_modulemodules/libphp4.so
Listen 192.168.0.2:80
# End

One thing I have noticed is that the libphp4.so built on OpenBSD is
 significantly smaller than on Linux (3M rather than 4.9M). I've tried to
 build the PHP module from the OpenBSD ports tree and it builds ok (though
 it's only just over 1M), but I get exactly the same result when trying to
 start Apache.

I've looked at the OpenBSD resource limits and these shouldn't be causing a
 problem.

If anyone has any idea what's going on (getting some error output would be a
 start) I'd be very grateful.

Alternatively, if anyone has an alternative approach, or a known working
 solution, I'm willing to give it a go.

regards,

Rich.


Re: [PHP-INSTALL] PHP & Apache2 on OpenBSD

2004-02-08 Thread r . php
Re my problem with Apache dying when I try and load the PHP module, it was
suggested to me that I should run strace on Apache when it is and isn't
trying to load PHP. Thanks to John Holden for the suggestion

Well

To keep the trace relatively simple, I actually did a ktrace (it's 'ktrace' on
OpenBSD, not 'strace') when just asking apache to do a syntax check. The
syntax check fails when I include the 'LoadModule libphp4.so' line.

So, the command line was:

ktrace httpd -t

To compare like with like, I ran this with the 'LoadModule access_module' and
then again with 'LoadModule php4_module'.

This is what I got. When asked to load the PHP module, apache seems to then go and 
search /usr/lib and /usr/local/lib. I'm assuming it's trying to resolve some 
dependencies arrising from the PHP module, but I have no idea what they might be. Am I 
missing some obvious dependencies ? What could apache be looking for ?

regards,

Rich.

=
(1) LoadModule access_module ...'

--snip--
   218 httpdCALL  read(0x5,0x3c0720c8,0x1000)
   218 httpdGIO   fd 5 read 314 bytes

 "# Apache 2 config

ErrorLog logs/error_log

LogLevel debug

ServerRoot "/usr/local/apache2"

User httpd
Group httpd

PidFile logs/httpd.pid

LoadModule access_module  modules/mod_access.so

# Dynamic Shared Object (DSO) Support
# LoadModule php4_modulemodules/libphp4.so

Listen 192.168.0.2:80

# EOF

   "
   218 httpdRET   read 314/0x13a
   218 httpdCALL  sigprocmask(0x1,0x)
   218 httpdRET   sigprocmask 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x3)
   218 httpdRET   mprotect 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x1)
   218 httpdRET   mprotect 0
   218 httpdCALL  sigprocmask(0x3,0)
   218 httpdRET   sigprocmask -65793/0xfffefeff
   218 httpdCALL  sigprocmask(0x1,0x)
   218 httpdRET   sigprocmask 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x3)
   218 httpdRET   mprotect 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x1)
   218 httpdRET   mprotect 0
   218 httpdCALL  sigprocmask(0x3,0)
   218 httpdRET   sigprocmask -65793/0xfffefeff
   218 httpdCALL  sigprocmask(0x1,0x)
   218 httpdRET   sigprocmask 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x3)
   218 httpdRET   mprotect 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x1)
   218 httpdRET   mprotect 0
   218 httpdCALL  sigprocmask(0x3,0)
   218 httpdRET   sigprocmask -65793/0xfffefeff
   218 httpdCALL  sigprocmask(0x1,0x)
   218 httpdRET   sigprocmask 0
   218 httpdCALL  mprotect(0x2946f000,0x1000,0x3)
   218 httpdRET   mprotect 0
   218 httpdCALL  mprotect(0x2946f000,0x1000,0x1)
   218 httpdRET   mprotect 0
   218 httpdCALL  sigprocmask(0x3,0)
   218 httpdRET   sigprocmask -65793/0xfffefeff
   218 httpdCALL  stat(0x3c0731f0,0xcfbefc88)
   218 httpdNAMI  "/usr/local/apache2"
   218 httpdRET   stat 0
   218 httpdCALL  sigprocmask(0x1,0x)
   218 httpdRET   sigprocmask 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x3)
   218 httpdRET   mprotect 0
   218 httpdCALL  mprotect(0x3c01f000,0x1000,0x1)
   218 httpdRET   mprotect 0
   218 httpdCALL  sigprocmask(0x3,0)
   218 httpdRET   sigprocmask -65793/0xfffefeff
   218 httpdCALL  sigprocmask(0x1,0x)
   218 httpdRET   sigprocmask 0
   218 httpdCALL  mprotect(0x2946f000,0x1000,0x3)
   218 httpdRET   mprotect 0
   218 httpdCALL  mprotect(0x2946f000,0x1000,0x1)
   218 httpdRET   mprotect 0
   218 httpdCALL  sigprocmask(0x3,0)
   218 httpdRET   sigprocmask -65793/0xfffefeff
  218 httpdCALL  open(0x3c073330,0,0)
   218 httpdNAMI  "/usr/local/apache2/modules/mod_access.so"
   218 httpdRET   open 6
   218 httpdCALL  read(0x6,0xcfbeeb64,0x1000)
   218 httpdGIO   fd 6 read 4088 bytes
   "\^?ELF\^A\^A\^A\0\0\0\0\0\0\0\0\0\^C\0\^C\0\^A\0\0\0P
--snip-- - binary image data

  \M-6\0\^A\0\0\M^KM\bQ\M-h\M-i\M-}\M^?\M^?\M^C\M-D\^P\M^E\M-@"
   218 httpdGIO   fd 6 read 8 bytes
   "t\^Z\M^C\M-D\M-|W\M^?\M-6"
   218 httpdRET   read 4096/0x1000
   218 httpdCALL  mquery(0,0x2000,0x5,0,0x6,0,0,0)
   218 httpdRET   mquery 123121664/0x756b000
   218 httpdCALL  mquery(0x2756b000,0x1000,0x1,0x10,0x,0,0,0)
   218 httpdRET   mquery 659992576/0x2756b000
   218 httpdCALL  mquery(0x2756c000,0x1000,0x3,0x10,0x,0,0,0)
   218 httpdRET   mquery 659996672/0x2756c000
   218 httpdCALL  mquery(0x2756d000,0x1000,0x3,0x10,0x,0,0,0)
   218 httpdRET   mquery 66768/0x2756d000
   218 httpdCALL  mquery(0x2756e000,0x1000,0x3,0x10,0x,0,0,0)
   218 httpdRET   mquery 660004864/0x2756e000
   218 httpdCALL  mmap(0x756b000,0x2000,0x5,0x12,0x6,0,0,0)