2023-05-12 开启多语言插件支持……

apache+php安装编译

Linux 苏 demo 2157℃ 0评论

这时我安装lamp时候的参考资料http://termite.blog.51cto.com/206292/53797

一、安装apache (httpd-2.2.15.tar.gz)

tar zxfv httpd-2.2.15.tar.gz
cd httpd-2.2.15
./configure –prefix=/usr/local/apache –enable-so –enable-rewrite –enable-mods-shared=most
说明:
–enable-so选项:让Apache可以支持DSO模式,注意,这里采用的是Apache2.0的语法。如果你的Apache是1.3版本,应改为–enable-module=so。
–enable-mods-shared=most选项:告诉编译器将所有标准模块都编译为DSO模块。你要是用的是Apache1.3,改为–enable-shared=max就可以。
–enable-rewrite选项:支持地址重写功能,使用1.3版本的朋友请将它改为–enable-module=rewrite。
make
make install
apachectl start 启动apache 完整的命令为:/usr/local/apache/bin/apachectl start

把apache加为系统服务
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

vi /etc/init.d/httpd

#chkconfig:2345 10 90
#description:Activates/Deactivate Apache Web Server
chkconfig –add httpd
二、安装php (php-5.3.2.tar.gz)

tar zxvf php-5.3.2.tar.gz

cd  php-5.3.2

./configure –with-apxs2=/usr/local/apache/bin/apxs –disable-debug –enable-safe-mode –enable-trans-sid –with-xml –with-mysql –enable-short-tags –with-gd –with-zlib –with-jpeg –with-png –enable-memory-limit –disable-posix –with-config-file-path=/usr/local/lib
参照上面我文章链接里面的这个编译出现如下问题

configure: error: Cannot find MySQL header files under yes.

Note that the MySQL client library is not bundled anymore!

后上网查询,得知的解决方法是:

如果不知道 header file 在哪,用 「find / -name mysql.h」命令找出其位置;(#注释我不知道这句是什么意思,不过也把他拿出来,如果谁有遇到这问题,知道为什么会这样请给我留言。 )

如果是自己也有手動安裝 MySQL 套件的話,直接指定該位置。(按照这句话编译后解决)

在 ./configure 下参数指定 header file 的位置(即mysql安装目录),加上如下语句:

./configure –with-apxs2=/usr/local/Apache/bin/apxs –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config

编译完后出现如下提示:

hank you for using PHP.

Notice: Following unknown configure options were used:

–enable-trans-sid
–with-xml
–with-jpeg
–with-png
–enable-memory-limit

Check ‘./configure –help’ for available options

这说明这些选项使用有问题,因为我这里没有编译安装这些格式的包,对于具体如何弄,我现在先留下,以后回过头来在补充。

说明:
? –with-apxs2=/usr/local/apache/bin/apxs \  这是加入apache中为DSO模块的位置
? –disable-debug \ #关闭php内部调试
? –enable-safe-mode \ #打开php的安全模式
? –enable-trans-sid \
? –with-xml \ #支持xml
? –with-mysql \ #支持mysql
? –enable-short-tags \ #支持PHP的短标记
? –with-gd \ #支持GD库
? –with-zlib \ #支持zlib
? –with-jpeg \
? –with-png \
? –enable-memory-limit \
? –disable-posix \
? –with-config-file-path=/usr/local/lib
总之复制粘贴就可以了,-_-
make
make install
cp php.ini-dist /usr/local/lib/php/php.ini 复制php的配置文件
cd /usr/local/lib/php/
vi php.ini  修改配置文件
register_globals = On   一般在399行
保存退出

注意:因为我的版本和我参考的文章的版本不一样,导致我在这里没有php.ini-dist 这个文件,通过看INSTALL文档发现有这么一句话

The PHP distribution provides two sample php.ini files, you can use them
by
cp php.ini-development /usr/local/lib/php.ini
or
cp php.ini-production  /usr/local/lib/php.ini

If you choose one of these php.ini files be certain to read the list
of changes within, as they affect how PHP behaves.

所以我执行了cp php.ini-production /usr/local/lib/php/php.ini这条命令。通过这在编译安装源码包的时候,大家不要一味的照抄网上的,因为我们各自所用的版本可能不同,这样我们在和他原封不动的敲命令时,我们可能就会遇到问题。这时记的看一下readme 或install是很有帮助的。

 

打赏

转载请注明:苏demo的别样人生 » apache+php安装编译

   如果本篇文章对您有帮助,欢迎向博主进行赞助,赞助时请写上您的用户名。
支付宝直接捐助帐号oracle_lee@qq.com 感谢支持!
喜欢 (0)or分享 (0)