Centos7.0 mini安装 安装后配置 以及 编译安装PHP7

大家好,我是雷丘,欢迎来到我的博客,这是我第一篇技术博文,如果有错误和不明白的地方,欢迎留言,收到第一时间回复。

最近在搞app服务端的程序,开始是thinkphp开发的,后来又使用了php自己开发架构,但是性能都不是很好,当然java,nodejs,python等高大上语言本人也会,但是我还是喜欢php,近期听说php7出来了,性能赶超HHVM,心里小激动,再加上开了 swoole,workerman,yaf等C语言开发php扩展,瞬间对php的性能有了新的认知,php也能达到几万几十万的QFS,所以准备学习下这几个 框架,然后测试下php7的性能。

我在 virtualbox 上 安装了  CentOS7.0的操作系统,主要目的还是测试php7 然后做开发

CentOS7.0 我用的是 mini安装,安装很快,安装好后,要对系统进行一些简单的配置

虚拟机网卡设置 使用桥接网卡,centos就可以上网了。

1.最小安装的centos7 不提供 ifconfig命令的支持

yum install net-tools

执行命令后 可以正常使用ifconfig产看网卡信息了。

2.CentOS 7.0默认使用的是firewall作为防火墙,需要关闭后用如下命令

1systemctl start firewalld.service#启动firewall 2systemctl stop firewalld.service#停止firewall 3systemctl disable firewalld.service#禁止firewall开机启动

3.安装一些常用的工具

1yum -y install bash-completion vim net-tools bind-utils wget screen 2 3yum groupinstall "Development tools"

4.安装依赖库,一大堆,一起yum安装了就

1yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng  2libpng-devel freetype freetype-devel libpng libpng-devel libxml2  3libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2  4bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel 5 libX11-devel gd-devel gmp-devel readline-devel libxslt-devel  6expat-devel xmlrpc-c xmlrpc-c-devel

5.安装cmake

1wget http://www.cmake.org/files/v3.3/cmake-3.3.0-rc2.tar.gz 2tar -zvxf cmake-3.3.0-rc2.tar.gz 3cd cmake-3.3.0-rc2 4./configure 5make && make install

6安装libxml2

1yum install libxml2 2yum install libxml2-devel

7安装libmarypt

1wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz 2tar -zxvf libmcrypt-2.5.7.tar.gz 3cd libmcrypt-2.5.7 4./configure 5make && make install

准备工作做好了,然后就是编译安装php7了,安装php7的主要目的是用 swoole开发项目,最新版的swoole支持php7,所以我就尝试下,据说php7的性能和HHVM的性能差不多,所以来测试下,再加上swoole的性能官方介绍秒杀nodejs,这个说法让我不禁熬夜测试安装。

php7目前只发布了阿尔法1版本,所以bug肯定还是有的,不建议用于生产环境

8.安装php7

可以直接下载,也可以从git上面获取

1wget https://downloads.php.net/~ab/php-7.0.0alpha1.tar.gz 2tar -zxvf php-7.0.0alpha1.tar.gz 3cd php-7.0.0alpha1

当然,php7比较新,很多程序还不支持,比如截至雷丘写日志的时候 swoole1.7.18还没出来,估计过几天,1.7.18才支持php7,所以这里给出一个php5.6.10的安装地址,国内镜像,嗖嗖的。

wget http://cn2.php.net/get/php-5.6.10.tar.gz/from/this/mirror

这里说些php7的编译参数

1./configure --prefix=/usr/local/php7 \--with-config-file-path=/usr/local/php7/etc \--with-mcrypt=/usr/include \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-gd \--with-iconv \--with-zlib \--enable-xml \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--enable-mbregex \--enable-fpm \--enable-mbstring \--enable-ftp \--enable-gd-native-ttf \--with-openssl \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--without-pear \--with-gettext \--enable-session \--with-curl \--with-jpeg-dir \--with-freetype-dir \--enable-opcache 2 3php5.6.10的编译参数 4./configure \ 5--prefix=/usr/local/php \ 6--with-config-file-path=/usr/local/php/etc \ 7--enable-fpm \ 8--with-fpm-user=php-fpm \ 9--with-fpm-group=php-fpm \ 10--with-mysql=mysqlnd \ 11--with-mysql-sock=/tmp/mysql.sock \ 12--with-libxml-dir \ 13--with-gd \ 14--with-jpeg-dir \ 15--with-png-dir \ 16--with-freetype-dir \ 17--with-iconv-dir \ 18--with-zlib-dir \ 19--with-mcrypt \ 20--enable-soap \ 21--enable-gd-native-ttf \ 22--enable-ftp \ 23--enable-mbstring \ 24--enable-exif \ 25--disable-ipv6 \ 26--with-pear \ 27--with-curl \ 28--with-openssl

如果编译出错了,可以看文章末尾的错误整理,或者百度检查下,系统可能缺少软件。

出现

1Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c 2+--------------------------------------------------------------------+ 3| License:                                                           | 4| This software is subject to the PHP License, available in this     | 5| distribution in the file LICENSE.  By continuing this installation | 6| process, you are bound by the terms of this license agreement.     | 7| If you do not agree with the terms of this license, you must abort | 8| the installation process at this point.                            | 9+--------------------------------------------------------------------+ 10Thank you for using PHP. 11config.status: creating php5.spec 12config.status: creating main/build-defs.h 13config.status: creating scripts/phpize 14config.status: creating scripts/man1/phpize.1 15config.status: creating scripts/php-config 16config.status: creating scripts/man1/php-config.1 17config.status: creating sapi/cli/php.1 18config.status: creating sapi/fpm/php-fpm.conf 19config.status: creating sapi/fpm/init.d.php-fpm 20config.status: creating sapi/fpm/php-fpm.8 21config.status: creating sapi/fpm/status.html 22config.status: creating main/php_config.h 23config.status: executing default commands

表示安装成功,如果一切顺利的话,执行

make && make install

根据你的机器配置,时间可能很快或者很慢哦,需要耐心等待。

php安装过程中常见错误信息整理,这也是我开始安装的时候经常出现的,因为linux是 mini安装的,所以很多程序系统都没有。

error 1

1checking for xml2-config path...  2configure: error: xml2-config not found. Please check your libxml2 installation.

(看提示就明白 是一个lib库没装  先用 yum search 名字 看是否能搜到名字 ,找到名字后 把软件包 开发包装上)

解决办法

yum install libxml2-devel.x86_64

error 2

1checking for pkg-config... /usr/bin/pkg-config 2configure: error: Cannot find OpenSSL's <evp.h>

这是ssl没装

解决办法

 yum  install  openssl.x86_64 openssl-devel.x86_64 -y

error 3

1checking for BZip2 in default path... not found 2configure: error: Please reinstall the BZip2 distribution

这是bzip2软件包没有安装

解决办法

yum install bzip2-devel.x86_64 -y

error 4

1configure: error: Please reinstall the libcurl distribution - 2    easy.h should be in <curl-dir>/include/curl/

curl和curl库文件没有安装

解决办法

yum install libcurl.x86_64 libcurl-devel.x86_64 -y

error 5

1checking whether to enable JIS-mapped Japanese font support in GD... no 2checking for fabsf... yes 3checking for floorf... yes 4configure: error: jpeglib.h not found

GD库没有安装

解决办法

yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

error 6

1checking for stdarg.h... (cached) yes 2checking for mcrypt support... yes 3configure: error: mcrypt.h not found. Please reinstall libmcrypt.

libmcrypt库没有安装 ,要是不能用yun安装的话  就要去下载个gz包 自己编译安装

(编译安装  ./configure --piefix=/usr/local/libmcrypt   make && make install)

要是错误里面含有mysql的  那是mysql-devel 没有安装

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )