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

Stella981
• 阅读 519

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

最近在搞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作为防火墙,需要关闭后用如下命令

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

3.安装一些常用的工具

yum -y install bash-completion vim net-tools bind-utils wget screen

yum groupinstall "Development tools"

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

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

5.安装cmake

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

6安装libxml2

yum install libxml2
yum install libxml2-devel

7安装libmarypt

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

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

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

8.安装php7

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

wget https://downloads.php.net/~ab/php-7.0.0alpha1.tar.gz
tar -zxvf php-7.0.0alpha1.tar.gz
cd 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的编译参数

./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

php5.6.10的编译参数
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-fpm \
--with-fpm-user=php-fpm \
--with-fpm-group=php-fpm \
--with-mysql=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-ftp \
--enable-mbstring \
--enable-exif \
--disable-ipv6 \
--with-pear \
--with-curl \
--with-openssl

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

出现

Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
Thank you for using PHP.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating main/php_config.h
config.status: executing default commands

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

make && make install

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

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

error 1

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

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

解决办法

yum install libxml2-devel.x86_64

error 2

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

这是ssl没装

解决办法

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

error 3

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

这是bzip2软件包没有安装

解决办法

yum install bzip2-devel.x86_64 -y

error 4

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

curl和curl库文件没有安装

解决办法

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

error 5

checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
configure: 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

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

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

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

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

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
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
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Stella981 Stella981
2年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
PHP创建多级树型结构
<!lang:php<?php$areaarray(array('id'1,'pid'0,'name''中国'),array('id'5,'pid'0,'name''美国'),array('id'2,'pid'1,'name''吉林'),array('id'4,'pid'2,'n
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这