源码安装CentOs7下的PHP7

率先安装APACHE环境,间接用yum安装

wget http://download.redis.io/releases/redis-4.0.8.tar.gz
tar xzf redis-4.0.8.tar.gz
cd redis-4.0.8.tar.gz
make
make install
yum install httpd httpd-devel
/etc/httpd/
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache

开头化配置脚本

将Redis源代码目录的utils文件夹中的redis_init_script 脚本复制到 /etc/init.d 目录中
cp source /etc/init.d/redis

然后安装mysql(mariadb)

布局与开发银行

建立目录存放Redis配置文件 
mkdir /etc/redis

建立目录存放Redis的持久化文件
mkdir /var/redis/6379

修改配置文件
将Redis配置文件模版 redis.conf (在源代码根目录下)  复制到 /etc/redis
cp source /etc/redis/redis.conf
vim etc.redis/redis.conf
 修改
  daemonize = yes
  pidfile  = /var/run/redis/pid
  port = 6379
  dir  /var/redis/6379

启动Redis
service redis start
停止redis
service redis stop
设置开机启动
chkconfig redis on
yum install mariadb mariadb-server
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
vi /etc/my.cnf
#最后添加 
log-slow-queries=/var/log/mariadb/slow.log
long_query_time=1
log-queries-not-using-indexes

systemctl start mariadb.service
mysql_secure_installation #(改密码,如果有密码 可能是root1234)

完装完这多少个条件之后,未来源码安装PHP7.2.8

#下载镜像文件
wget http://hk1.php.net/get/php-7.2.8.tar.gz/from/this/mirror 
tar zxvf mirror
cd php-7.2.8

#如果是新环境,需要安装一些依赖
yum install autoconf gcc  httpd-devel libxml2 libxml2-*  openssl.x86_64 openssl-devel.x86_64  libcurl.x86_64 libcurl-devel.x86_64  libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64  libjpeg-turbo-devel -y

./configure --with-mysqli --with-curl --with-apxs2=/usr/bin/apxs --with-openssl --enable-mbstring --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-jpeg-dir --with-config-file-path=/etc/php.ini 

make && make install

 

后来要布署APACHE的安插文件

vi /etc/httpd/conf/httpd.conf
#找到LoadModule 大约在54行左右,在注释下面,加入下面的配置
#php.ini的目录
PHPIniDir /etc
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so

#解析.php文件
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>


AddType application/x-httpd-php .php

其后重启apache就能够利用了

systemctl restart httpd.service

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图