php5.5.33 源码安装,httpd 2.4.9 + mysql-5.5.33 + php-5.4.26编译安装过程

安装mariadb到/usr/local/下

解压到该目录# tar xf mariadb-5.5.36-linux-x86_64.tar.gz -C /usr/local/

9619dc22845e43cc8dfa509e86619675.png

为后期方便升级使用给mariadb-5.5.36-linux-x86_64创个链接# ln -sv mariadb-5.5.36-linux-x86_64/ mysql

b588a280c1e22fdbea34bc89702641a4.png

6f7e13097efef67efa8c7cd02c4ed743.png

mysql的数据库文件默认是在/usr/local/mysql/data/下的,随着数据的增加,放这里不妥。创建逻辑卷来存放数据,以便后期随时扩展,创建好逻辑卷后挂载到/mydata/data/下。

mysql是由root启动后以普通用户mysql的身份来运行的,故添加系统组,系统用户:mysql,mysql。

修改/mydata/data/目录的属主属组# chown -R mysql.mysql /mydata/data/

f9e27970a553be266c764d5b89d1d116.png。# cd /usr/local/mysql

修改里面的所有文件属主root属组mysql:# chown -R root.mysql ./*

a571bb135308475f5bc0f58e06846e25.png

mysql的初始化:

因为在/etc/下已存在 my.cnf。所有新建# mkdir /etc/mysql。

复制配置文件# cp support-files/my-large.cnf /etc/mysql/my.cnf并编辑# vim /etc/mysql/my.cnf

83a9024b0ae7b0088fb512306ca5967e.png

cd到/usr/local/mysql /下,要依赖此目录下的./bin。初始化数据库的脚本执行# scripts/mysql_install_db --user=mysql --datadir=/mydata/data

170c5b1f0030ebefc57a46bae84ffbd2.png

数据库已经生成# ls /mydata/data

e794bcfb73cb6eb26d50113e453e77ea.png

复制服务脚本# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

91f2edacf4c30782efda05798dadada0.png

加到服务列表中# chkconfig --add mysqld

c10437837e23257d5af1949567db6ad1.png

db44d32dbfd0e217526607095f2e3b59.png

启动服务# service mysqld start

8c70cc1bece2dadf39ce904dbdabcf4b.png

此时还不能用mysql客户端,因为没有添加环境变量# vim /etc/profile.d/mysql.sh

cfcfe2253eaeb00ae93b8f86b31ab7b8.png

9a806b3ecd7dd5b8fcde22039ffd78e8.png# source /etc/profile.d/mysql.sh

e8e724e540467d6e6fd9211551a3d4ae.png

导出头文件# ln -sv /usr/local/mysql/include/ /usr/include/mysql

1622d625e941d2ff20d8e87d0efaede0.png

更新版本客户端库# vim /etc/ld.so.conf.d/mysql.conf

b42c9e9ddc4dac63d1a1b7f62d56836f.png

84e66396acfcd442d55ad76f21b3b828.png

编译安装httpd,httpd程序依赖于apr和apr-util,故下载源码httpd-2.4.9.tar.bz2和apr-1.5.0.tar.bz2

,apr-util-1.5.3.tar.bz2

先安装apr,解压#  tar xf apr-1.5.0.tar.bz2

cd到apr-1.5.0

执行# ./configure –prefix=/usr/local/apr

# make && make install;

然后安装apr-util# tar apr-util-1.5.3.tar.bz2

# cd apr-util-1.5.3

# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr

# make && make install;

编译安装httpd# tar xf httpd-2.4.9.tar.bz2

# cd httpd-2.4.9

#  ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24

--enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre

--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

--enable-modules=most --enable-mpms-shared=all --with-mpm=event

#  make && make install。

配置http的启动;#  cd /etc/httpd24

为保险备份一份httpd.conf#  cp httpd.conf httpd.conf.bak

编辑httpd.conf# vim httpd.conf

加入PidFileb2d24a1f9518538b8aa74b464268f1a1.png

编辑# vim /etc/rc.d/init.d/httpd24

提供SysV服务脚本到/etc/rc.d/init.d/httpd24

为其加执行权限# chmod +x /etc/rc.d/init.d/httpd24

添加至服务列表中# chkconfig --add httpd24

d4ac78c4e3af87b6c6410359024ae0d5.png

启动# service http24 start.

编译安装php:

首先解决依赖关系,安装各包组和包# yum -y groupinstall "Desktop Platform Development" # yum -y install

bzip2-devel libmcrypt-devel

# cd php-5.4.26

# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql

--with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring

--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib

--with-libxml-dir=/usr --enable-xml  --enable-sockets

--with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt

--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2

--enable-maintainer-zts

# make && make install

# cd /etc/httpd24

# vim httpd.conf

添加AddType application/x-httpd-php  .php

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

找到  DirectoryIndex  index.html  修改为  DirectoryIndex  index.php

index.html# cp php.ini-production /etc/php.ini

重新载入# service httpd24 reload即可

测试下php# cd /usr/local/apache/htdocs/

# vim index.html

e4b617c3f220d04bfe4cb96a03e2dc9f.png# mv index.html index.php

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值