Subject: Re: More Apache/PHP installation puzzles
From: Igor Pechtchanski <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Tue, 16 Sep 2003 11:45:04 -0400 (EDT)

Dave,

First off, there is no need to Cc: the apache maintainer, as I know for
sure that he reads this list (unless this is specifically requested in the
README, in which case I apologize).

More replies inline below.

On Tue, 16 Sep 2003 [email-masked] wrote:

> This all started when I had trouble installing Apache/PHP (see earlier posts
> Re: Apache/PHP installation puzzle).  As this problem is a bit more general I
> thought I would start a new thread.
> In a nutshell, the PHP part of the installation fails without any obvious
> errors.  In order to find out what's going on I decided to remove every vestige
> of Cygwin from the W2K box and re-install the minimum required to ivestigate
> this problem.
>
> This is the story .....
>
> 1. Install Cygwin with nano, apache, and mod-php4.  NOTE.  Install
> Cygwin 1.5.3-1 because there are issues with 1.5.4-1 that prevent
> processes being stopped properly.
> 2. Start the apache server ....
>
> $ /usr/sbin/apachectl start
> [Tue Sep 16 14:54:56 2003] [alert] httpd: Could not determine the server's fully
>   qualified domain name, using 192.168.40.12 for ServerName
> /usr/sbin/apachectl start: httpd started
>
> 3.  Using the Windoze browser, visit http://localhost/.  See the expected
> default Apache installation page - so far, so good.
> 4.  Using the favourite nano editor, create the xyzzy.php script and put
> it in /var/www/htdocs.  The script contains the simple PHP function call
> <?phpinfo()?> and nothing else.
> 5.  Visit http://localhost/xyzzy.php and the script is simply presented
> on the page - a clear indication that the PHP is not being translated.
> 6.  Check out /etc/apache/httpd.conf and there is no mention of php in here.
> What's needed are lines of the form:
>
> LoadModule php4_module lib/apache/libphp4.dll
> AddModule  mod_php4.c
>
> Add these and try again ....
> $ /usr/sbin/apachectrl start
> Syntax error on line 236 of /etc/apache/httpd.conf:
> Cannot load /usr/lib/apache/libphp4.dll into server: dlopen: Win32 error 126
> /usr/sbin/apachectrl start: httpd could not be started
>
> 7. As error 126 is basically 'file not found', we'll check for the
> existance of the libphp4.dll.

Note that some other required DLL may be missing as well.

> First:
> $ updatedb
> Then:
> $ locate libphp4
>
> .... no trace of the DLL to be found!!!
>
> 8.  Now this is interesting!
>
> $ cd /usr
> $ ls
> doc  etc  include  info  local  man  sbin  share  src  ssl  tmp  var
>
> Note the lack of a lib directory.  However...
>
> $ cd lib
>
> Administrator@zebedee /usr/lib
> $
>
> ...?Que!!?  How can one cd to a directory that doesn't exist. Not only
> that, but

"man mount".  If it makes you feel better, you can "cd /usr && cmd /c
'md lib' && cmd /c 'md bin'" to see the directories in the listing (and
get Tab-completion).

> $ ls
> apache          libc.a          libhistory.a            libxm12.a
>
> ...
> ...
>
> libbz2.dll.a    libgmon.a
>
> And so /usr/lib exists but is partially invisible.  Interestingly,
> Windows can't see this directory either.  Hence one possible explanation
> of why the dll won't load.

If Cygwin's mechanisms are used to load the DLL, the directory will be
seen (it's a mount).

> 9.  Progressing further ....
>
> $ cd /usr/lib/apache
> $ ls
> libproxy.dll    mod_autoindex.dll       mod_imap.dll    mod_setenvif.dll
>
> ...
> ...
>
> mod_auth_dbm.dll        mod_headers.dll mod_rewrite.dll new
>
> $ ls new
>
> Administrator@zebedee /usr/lib
> $
>
> No trace of the missing dll - a possible second reason why the Windows load
> failed.
>
> 10.  Seems that something must be going wrong in the post install script
> too!  What we'll do is manually install the package and see what's going
> on.  Copy the .tar.bz2 file to / and then:
>
> $ bunzip2 apache-php-4.3.0-2.tar.bz2
>
> Administrator@zebedee /
> $ tar -xvf apache-php-4.2.0-2.tar
> etc/
> etc/postinstall/
> etc/postinstall/apache-php.sh
> usr/
> usr/doc/
> usr/doc/Cygwin/
> usr/doc/Cygwin/php-4.2.0-2.README
> usr/doc/php-4.2.0-2/
> usr/doc/php-4.2.0-2/CREDITS
> usr/doc/php-4.2.0-2/INSTALL
> usr/doc/php-4.2.0-2/LICENSE
> usr/doc/php-4.2.0-2/NEWS
> usr/lib/
> usr/lib/apache/
> usr/lib/apache/new/
> usr/lib/apache/new/libphp4.dll
>
> Administrator@zebedee /
> $
>
> This unpacks everything and doesn't run the post install script.  Now
> we'll run the post install script and see what's going on:
>
> Administrator@zebedee /etc/postinstall
> $ cd /etc/postinstall/
>
> Administrator@zebedee /etc/postinstall
> $ ./apache-php.sh
> usage: rebase -b BaseAddress [-Vdv] [-o Offset] [-T FileList | -] Files...
>
> Administrator@zebedee /etc/postinstall
> $
>
> So, it seems that either rebase is being called incorrectly or the argument
> list is invalid.

Do you have the "rebase" package installed?

> 11. The check the argument list, add the following line
> to /etc/postinstall/apache-php.sh and re-execute it.
>
> Add...
>
> echo ${rebase_dlls} immediately following the line starting "rebase_dlls="$"
>
> Re-running gives:
>
> Administrator@zebedee /etc/postinstall
> $ ./apache-php.sh
> /usr/lib/apache/libphp4.dll /usr/bin/cygbz21.0.dll /usr/bin/cygcrypto.dll /usr/b
> in/cygintl-1.dll /usr/bin/pq.dll /usr/bin/cygxml2-2.dll /usr/bin/cygz.dll /usr/b
> in/cyggdbm.dll
> usage: rebase -b BaseAddress [-Vdv] [-o Offset] [-T FileList | -] Files...
>
> Administrator@zebedee /etc/postinstall
> $
>
> Checking the list of file names we find that
> neither /usr/lib/apache/libphp4.dll nor
> /usr/bin/cygcrypto.dll exists.

libphp4.dll should have been copied from the "new/" subdirectory to
/usr/lib/apache by the apxs call in the postinstall script.  If it wasn't,
something went wrong with the apxs call.

Use the package search page at <http://cygwin.com/packages/> to find out
which package contains "usr/bin/cygcrypto.dll" and install it (FWIW, it
should have been selected for install automatically -- did you unselect
any packages before installation?).

> Looking at apache-php.sh I'm not sure that the call to rbase is right
> either - but I've got to too many errors now.
>
> So there we have it - the story of trying to install Apache/PHP.
>
> I hope that I've provided enough information for the
> developers/maintainers to quickly come to a solution as having PHP
> available in a mixed Linux/Window 2K box will be very useful for
> development purposes.
>
> Regards,
> Dave

Hope this helps,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		[email-masked]
ZZZzz /,`.-'`'    -.  ;-;;,_		[email-masked]
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/