lamp php源码安装,LAMP源码安装方法

lamp源码安装方法

先安装centos系统,然后更新:

yum -y install apr-devel apr-util check-devel cairo-devel pango-devel libxml2-devel rpmbuild glib2-devel dbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel python-devel libXrender-devel

mysql 源码包安装

1.useradd mysql

2.passwd mysql(增加密码,可以不用)

3.进入mysql源码包解压目录

cacti安装时的方法:

./configure--prefix=/usr/local/mysql --enable-local-infile--with-charset=gbk--with-extra-charsets=all--with-low-memory--with-mysqld-user=mysql --enable-thread-safe-client

4.make

5.make install

cp support-files/my-medium.cnf /etc/my.cnf

6.cd /opt/mysql5

7.chown -R mysql:mysql .

8.bin/mysql_install_db --user=mysql

9.chown -R root .

chown -R mysql var

10.bin/mysqld_safe --user=mysql &(启动mysql)

11、ln -s /usr/local/mysql/bin/* /usr/local/bin(可以直接运行mysql里面的命令了,不用在打目录)

自启动的配置方法

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod +x /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

service mysqld start

11.bin/mysqladmin shutdown(关闭mysql)

service mysqld stop

apache与php安装

1.进入httpd的解压目录

./configure --enable-so --prefix=/opt/www(普通安装)

cacti安装方法:

./configure--prefix=/usr/local/www --enable-so --enable-rewrite --enable-ssl--with-ssl=/usr/local/openssl --with-zlib--enable-mods-shared=all--enable-track-vars--with-mysql=/usr/local/mysql --with-included-apr

make

make install

/opt/www/bin/apachectl start|stop

ln -s /opt/www/bin/apachectl /usr/local/bin/apachectl

cp /opt/www/bin/apachectl /etc/rc.d/init.d/httpd

chkconfig --add httpd

chkconfig --list httpd

service httpd start

apache安装好了

2.安装php,进入php解压目录

./configure--with-apxs2=/opt/www/bin/apxs--with-mysql=/opt/mysql5 --enable-sockets

说明:

./configure--with-apxs2=/opt/www/bin/apxs(安装好的apache里面的apxs目录) --with-

mysql=/opt/mysql5(mysql的安装目录) --enable-sockets(cacti必须要带的参数)

./configure--prefix=/usr/local/php--with-config-file-path=/etc-with-apxs2=/usr/local/www/bin/apxs --enable-fastcgi --enable-safe-mode --with-zlib --with-bz2 --with-freetype-dir --enable-mbstring-with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --with-libxml-dir --with-png-dir --with-jpeg-dir --enable-sockets

(出现要安装的lib库,用yum安装一下,包括库的-devel库)

make

make install

cp php.ini-dist /etc/php.ini

(配置目录在./configure里面说明了是/etc)

在httpd.conf里面修改:

找到下面字段:

DirectoryIndex

在index.html前面添加index.php

增加:

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

3.启动apache

/opt/www/bin/apachectl start

mysql下载

php下载

apache下载

========================================

错误解决:

安装apache时类似于以下信息:

“exports.c:1653: error: redefinition of 'ap_hack_apr_version_string'

exports.c:1022: error: previous definition of 'ap_hack_apr_version_string' was here

make[2]: *** [exports.lo] Error 1

make[2]: Leaving directory `/usr/local/src/httpd-2.2.*/server'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/usr/local/src/httpd-2.2.*/server'

make: *** [all-recursive] Error 1”

有些人说路径不对,有些说perl包不对,有的说zlib不对。

反正有病乱投医。

翻了好久的网页才搞定。

解决办法:

在configure后加上 “--with-included-apr”。

【编辑推荐】

【责任编辑:高圆圆 TEL:(010)68476606】

点赞 0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值