搭建了自己的lamp环境

本文详细介绍Apache2.2.14及PHP5.2.14和PHP5.3.5的安装配置过程,包括配置选项解释及依赖库安装等关键步骤。适合初学者快速上手。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


apache2.2.14

资料主要来自apache2.2说明文档安装、配置部分。

./configure --prefix=/usr/local/apache2 \
--enable-mods-shared=all \
--enable-so \
--enable-cache \
--enable-deflate \
--enable-disk-cache \
--enable-expires \
--enable-headers \
--enable-rewrite \
--enable-ssl


mysql

使用二进制分发包安装(采用redhat系统分发版)。服务器RPM将数据放入/var/lib/mysql目录。RPM还为mysql用户创建登录账户(如

果还没有),用来运行MySQL服务器,并在/etc/init.d/创建相应条目,以便在引导时自动启动服务器。
/usr/bin/mysqladmin -u root password 'new-password'(执行这一个就可以了)
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'


php5.2.14

安装php的过程中,很多扩展都需要额外库的支持,没事,遇到一个错误解决一个(centos5.5下的yum很好用,需要联网)。
当有不合法的配置项是,配置结束后还会提示,good。


./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr \
--with-mysqli=/usr/bin/mysql_config \
--with-pdo-mysql=/usr \
--enable-fastcgi \
--enable-force-cgi-redirect \ //php手册中提到如果以cgi方式安装,将这个选项配置上
--with-pear \
--with-openssl \
--with-zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif \
--enable-ftp \
--with-gd \
--with-ttf \
--enable-gd-native-ttf \
--with-gettext \
--with-gmp \
--with-imap \
--with-kerberos \
--with-imap-ssl \
--with-ldap \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--with-mm \
--enable-soap \
--enable-sockets \
--with-tidy \
--enable-wddx \
--with-xsl \
--enable-zip \
--enable-shared

php5.3.5

./configure --prefix=/usr/local/php5.3.5 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=shared,/usr \
--with-mysqli=shared,/usr/bin/mysql_config \
--with-pdo-mysql=shared,/usr \
--with-pear \
--with-openssl=shared \
--with-zlib=shared \
--enable-bcmath \
--with-bz2=shared \
--enable-calendar \
--with-curl=shared \
--enable-exif \
--enable-ftp \
--with-gd=shared \
--enable-gd-native-ttf \
--with-gettext=shared \
--with-gmp=shared \
--with-imap=shared \
--with-kerberos \
--with-imap-ssl \
--enable-intl \
--with-ldap=shared \
--enable-mbstring \
--with-mcrypt=shared \
--with-mhash \
--with-mm=shared \
--enable-soap \
--enable-sockets \
--with-tidy=shared \
--enable-wddx \
--with-xsl=shared \
--enable-zip \
--enable-shared

安装后在apache配置文件中已经添加了‘LoadModule php5_module modules/libphp5.so’。
php安装完成后运行‘make test’测试php(可选,太多了,8000+个测试,我选择不测试)。
在httpd.conf文件中加入‘AddType application/x-httpd-php .php’,‘DirectoryIndex index.html index.php’。
我这里的module都是静态编译到php中了,要想编译成shared模块,如下使用‘--with-gd=shared’,注意不是所有模块都可以编译成

shared。

使用shared编译后,默认是没有加载任何模块的,需要自己动手编译需要的模块,使用phpize、pear编译(都很容易)。

$ cd extname

$ phpize //一般位于php_install_path/bin

$ ./configure --with-php-config=/usr/local/php5.2.14/bin/php-config //一般位于php_install_path/bin

$ make && make install


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值