• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

CygwinPHP+ApacheonWindowsinstalltips

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]
  • From: "Karl Brown" <brown at gnvc dot org>
  • To: cygwin at cygwin dot com
  • Date: Wed, 14 Jan 2004 14:05:21 -0600
  • Subject: Cygwin PHP + Apache on Windows install tips

So, you're having trouble installing PHP and Apache under Cygwin on windows?? 

I've just suffered through some pain in setting this up - the following thread was  
useful to me: 
http://www.cygwin.com/ml/cygwin/2003-09/msg01028.html 

More importantly, I actually figured out how to make it work.  Here are the changes  
you have to make if you really want to go this route.  Looking back, I think I would  
have been better off installing a vanilla windows version of apache, and the vanilla  
windows distribution of PHP - that is what most people do and it seems to work  
better.  But if you want to go the hardcore route, see below. 

1) This was done with Apache 1.3.24-5 and PHP 4.2.0-2. 
2) I will assume that apache is already installed and working - even doing that is  
non-trivial, but this page is helpful:  
http://apache.dev.wapme.net/manual/cygwin.html.  Just remember that apache  
cygwin does not accept windows directory names (i.e. d:/foo/bar) - you have to use 
/cygdrive/d/foo/bar 
3) There are bugs in the PHP installer, so we have to work around them.  Luckily, it  
is not that difficult. 

so, the steps: 
0) Stop your apache server 
1) Install the PHP package using the cygwin installer.  This will copy the  
documentation, but you'll notice that the libphp4.dll is somehow missing!  This is the  
first bug. 
2) To correct this bug, you'll have to edit the apache-php.sh script which is stored in  
/etc/postinstall - it should be named 'apache-php.sh.done' at this point. 
3) Open it up, save a backup copy, and replace it with the following: 

=== 
#!/bin/sh 
module=php4 
module_dll=libphp4.dll 
prefix=/usr 
confdir=/etc 
libdir=${prefix}/lib/apache 
echo ${libdir} 
rebase_dlls="${libdir}/${module_dll}  
${prefix}/bin/cygbz21.0.dll ${prefix}/bin/cygcrypto.dll  
${prefix}/bin/cygintl-1.dll ${prefix}/bin/pq.dll  
${prefix}/bin/cygxml2-2.dll ${prefix}/bin/cygz.dll  
${prefix}/bin/cyggdbm.dll ${prefix}/bin/cygssl-0.9.7.dll   
D:\apps\cygwin\bin\cygiconv-2.dll" 
echo ${rebase_dlls} 
cd ${libdir}/new 
${prefix}/sbin/apxs -i -a -n ${module} ${module_dll} 
echo ${module} ${module_dll} 
${prefix}/bin/rebase -d -b 0x68000000 -o 0x10000  
${rebase_dlls} 
#${prefix}/bin/rebase ${rebase_dlls} 

#don't remove module dll 
#rm -f ${libdir}/new/${module_dll} 

=== 
The changes I made were: 
1) add ${prefix}/bin/cygssl-0.9.7.dll  D:\apps\cygwin\bin\cygiconv-2.dll to the dlls to  
be re-based.  This I figured out through trial and error 
2) uncommented the rebase command that had been commented out, and  
commented out the rebase command with bad syntax (no -d -b 0x etc.) 
3) commented the line that removes the libphp4.dll 


Also, rename the file to apache-php-sh 

4) unzip and untar the php distribution - it should be wherever you set Cygwin to  
download packages. 
> cd {wherever this file is located} 
> bunzip2 apache-php-4.3.0-2.tar.bz2 
> tar -xvf apache-php-4.2.0-2.tar 

Within this tarball, you should be able to find libphp4.dll - drop that in /lib/apache 

5) Now, run the post install script: 
$ sh apache-php.sh 

This should now rebase all of the necessary dlls and install the libphp4.dll as a  
shared object. 

6) Now open up your httpd.conf file and add the following lines: 

LoadModule php4_module lib/apache/libphp4.dll 
AddModule mod_php4.c 
AddType application/x-httpd-php .php 

7) now take a sample .php page and start up your apache server - it should be  
working now.  if you want to set up your php as a CGI handler, there are other  
resources on the web for that. 

I hope this helps someone else out there, and hopefully whoever is in charge can fix  
these (relatively) simple problem in the installer script. 

thanks, 
karl brown 
karl at cs.stanford.edu_nospam 
(remove nospam to send) 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap