安装PHP基本支持库

libxml2

zlib

ligpng

gd

基本都是按如下流程编译安装,但注意安装的顺序:

cd source-path

./configure

make

make install

MySQL rpm包安装

rpm -ivh MySQL-server-community-5.1.41-0.rhel5.i386.rpm #服务端

rpm -ivh MySQL-client-community-5.1.41-0.rhel5.i386.rpm #客户端

rpm -ivh MySQL-devel-community-5.1.41-0.rhel5.i386.rpm #PHP编译时需要用到

复制配置文件

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

编译安装PHP5

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-gd=/usr/local --with-mysql --with-libxml-dir --with-png-dir --with-pear=/usr/local/php/pear --enable-mbstring --with-config-file-path=/usr/local/php/ --disable-debug --enable-safe-mode

make

make install

cp php.ini-production /usr/local/php/php.ini #复制php配置文件到设定的目录

如果不需要支持pear,可以去掉 --with-pear=/usr/local/php/pear

接下来就可以配置LAMP了,想关配置文件如下

PHP配置文件:/usr/local/php/php.ini

Apache主配置文件:/usr/local/httpd/conf/httpd.conf

MySQL配置文件:/etc/my.cnf

相关启动命令

service mysql start|stop|restart

/usr/local/httpd/bin/apachectl -k start|stop|restart

以上如有不明或遗漏或有更好的方案,请不惜键盘,给我留言,谢谢。

听说LNMP(Linux+Nginx+MySQL+PHP)比较省内存,下次想试试。

通过文章的描述,你是不是也想在VPS上安装LAMP呢,赶快动手吧!

  • LAMP配置之终结篇
  • 深入分析 LAMP 架构
  • LAMP必须是Web开发最流行的工具
  • LAMP系列之源码级别研究Apache
  • 精简的LAMP环境搭建
  • 学习 Flickr 的 基于 LAMP 的容量规划经验
  • Redhat Linux AS4下的LAMP与Discuz装置


相关内容