php5 on cygwin

Helmut Hänsel Helmut.Haensel@uni-bayreuth.de
Fri Dec 2 16:10:00 GMT 2005


 >2005/11/8, pobox@verysmall.org <pobox@verysmall.org>:
 >> ./configure --with-apache=[PATH TO APACHE SOURCE DIRECTORY FROM POINT
 >> 1.] --with-pgsql
 >>
 >> I use PostgreSQL so I quote it literally. Perhaps it would work with
 >> another database too and perhaps it will work without. Note that I did a
 >> default compile of PostgreSQL 8.0.4 from sources. I am _not_ sure if you
 >> get it as cygwin package that this way it will work, as I suspect that
 >> the cygwin PostgreSQL package is not installed in the same locations as
 >> if you compile PostgreSQL from source.
 >
 >There are the binary cygwin packages for postgresql, just in test.
 >built yesterday
 >  (8.0.4 and 8.1.0)
 >  http://xarch.tu-graz.ac.at/publ/cygwin/release/postgresql/
 >
 >In README is the binary layout. It should work OOTB.
 >--
 >Reini Urban

Hello,

I just read your conversation on php under cygwin.
Two days ago I succeeded in compiling PHP 5.1 as .so-module for apache 
2.0 and thought you might be interested to read a short HowTo:

----------------   Prerequisites  (install via cygwin setup)  
--------------------

 - Apache2 (2.0.54-1) with devel Packages
 - PostgreSQL (in my case 8.0.4)
 - apr, aprutil, rebase
 - minires with devel Packages (in order to provide support of -lresolv)

... other packages, that compilation may depend on (see Iv's remarks on 
the compilation of Apache 1.3 )
bison, cvs, flex, gcc, gd, grep, keychain, libtool1.5, libxml, libxml2, 
libxml2-devel, make, openssh, perl, readline, rsync, unzip, vim, whois, zip

----------------   Configuration of PHP --------------------

download and unpack php-src into /usr/src/php...

cd /usr/src/php...
./configure --with-apxs2=/usr/sbin/apxs2 --without-pear --with-pgsql 
--with-curl


Open the Makefile and make the following changes:

 1) Add "-lhttpd2core -lapr -laprutil" to the "EXTRA_LIBS":
    EXTRA_LIBS = -lcrypt  [...] -liconv -lm -lcrypt -lhttpd2core -lapr 
-laprutil

 2) Add "-no-undefined" to "EXTRA_LDFLAGS":
    EXTRA_LDFLAGS = -avoid-version -no-undefined -module

 3) in the section libs/libphp5.bundle: add -shared after $(CC):
    $(CC) -shared $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) [...] -o $@ && cp 
$@ libs/libphp5.so

 4) in the same line replace
    $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o)
      by
    `echo $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) | sed "s/\([^/ 
]*\)\.lo/.libs\/\1.o/g"`

    ( contrary to the behaviour of the php 5.0.5 distribution, somehow 
the libtool decided to place the object files in .libs subdirectories. 
This is why I put the nasty sed command. - Maybe, there is a more 
elegant solution?)

----------------   Compilation of PHP  --------------------

make
make libs/libphp5.bundle

cp libs/libphp5.so /lib/apache2/libphp5.so

make install

----------------    Configuring and Starting Apache    --------------------

Add the following lines to httpd.conf:

  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps

/usr/sbin/apachectrl2 start

if this fails with an error "unable to map ...":

  Exit all cygwin windows
  Stop cygserver (via Workplace->Manage->Services->Services->Stop)
  In a command window (cmd.exe) call C:\cygwin\bin\ash
  /bin/rebaseall -v
  Restart cygserver

Try again "/usr/sbin/apachectrl2 start" and enjoy
That's Voodoo ;-)


--
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/



More information about the Cygwin mailing list