Computery bits & bobs.
Cygwin
Cygwin is an environment for Windows (Win32) that provides the feel of a Linux machine. Basic Cygwin gives you a shell (eg BASH) and GNU tools (that you can decide upon at Cygwin install). On top of this you can install X windows (X.org), graphical applications and if you want, a graphical environment such as KDE.CAMP - Cygwin, Apache, MySQL, PHP/Perl
This is a very useful setup if you want to be able to try out ideas when you're away from a server/other Linux box.Installing PHP
Note: The changes to the Makefile detailed below come from a post attributed to a Helmut Hänsel on Friday 02 December 2005. I have made changes that seemed to fit well with my Cygwin install.Cygwin doesn't come with PHP as an install option (unlike Perl which is selectable in the installer). Therefore you have the joy of installing PHP. Which, if like me, won't take the obvious
./configure && make && make install route.You'll need to make sure you have the full development environment installed. I just re-ran
setup.exe and clicked on "view" in the upper right hand corner to get the "full" view. Then just selected everything that looked useful. Not scientific but it worked.Then you need of course to have already Apache2 (Cygwin installer).
- Get the sources. At the time of writing, I used the bzipped 5.1.2 tarball
- Put the file somewhere safe - I put it in
/src/. Untar it, then work through the following. ./configure --with-apxs2=/usr/sbin/apxs2 --with-curl --with-pcre --with-gd --with-zlib --with-jpeg-dir=/usr/local/ --with-xml --with-png-dir=/usr/local/ --enable-calendar --enable-sockets- Edit the Makefile as follows:
Add "-no-undefined" toEXTRA_LDFLAGS
Find the lineEXTRA_LIBSand at the end add-lhttpd2core -lapr-0 -laprutil-0
Find the linelibs/libphp5.soand:
After this line replace$(CC)with$(CC) -shared
Same line, swap out$(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o)with`echo $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) | sed "s/\([^/ ]*\)\.lo/.libs\/\1.o/g"`
make && make libs/libphp5.bundle
cp libs/libphp5.so /lib/apache2/libphp5.so
cp libs/libphp5.so /lib/apache2/cygphp5.so
make install - If you haven't already told Apache how to interpret php files, add the types to the httpd.conf at the appropriate point:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
- Here's the clincher...
/usr/sbin/apachectl2 start - You might get something like this:
blah blahunable to map [...] addr != addrblah
If you do, try the following:
Stop the Cygwin service (services.msc)
Quit out of everything cygwin related
start up ash from a command shell.cd /bin. Then runrebaseall -V
This will run through all the dlls installed for Cygwin. However you might stop at an error. Make a note of the dll that appears in the "unable to map" error. Also make a note of the address after the "!=" Run the following:
/bin/rebase -b <addr> -V <filename>
e.g.
[Fri Jan 20 22:15:49 2006] [warn] module php5_module is already loaded, skipping
httpd2: Could not determine the server's fully qualified domain name, using 192.168.0.89 for ServerName
6 [main] httpd2 3424 C:\cygwin\usr\sbin\httpd2.exe: *** fatal error - unable to remap C:\cygwin\bin\cygz.dll to same address as parent(0x19610000) != 0x19620000
306 [main] httpd2 2696 child_copy: loaded dll data write copy failed, 0x6F5E8000..0x6F5E8660, done 0, windows pid 2288548, Win32 error 5
stop cygserv
exec ash
cd /bin
rebase -v -b 0x19620000 /bin/cygz.dll - Restart the Cygwin service, and rerun the
apachectl2command.