导航:首页 > 源码编译 > 源码编译php7

源码编译php7

发布时间:2023-05-25 21:14:43

㈠ 如何在openSUSE42.1下编译安装php7

首先推荐一篇文章
PHP
7
Release
Date
Arrived:
Will
Developers
Adopt
PHP
7?
-
PHP
Classes
blog

里面说到是否会去使用PHP7,就个人而言,我是毫不犹豫地使用的,但是生产环境就不是我说了算,所以只能自己在自己的开发环境里更新PHP的版本。那么,你呢?
笔者使用的是linux的openSUSE42.1发行版,Yast里面还没有PHP7的安装包,于是乎只能自己手动编译安装了。作为一个PHP开发者,我是非常希望能够学会编译安装PHP7的,之前试过几次,但是每次安装都要上网找各种资料,于是乎,这次安装成功后就想把自己的安装过程以及遇到的问题记录下来,方便以后查阅和分享给需要的人。
下载源码解压
进入正题,要编译安装PHP7,首先当然要下载PHP7的源码。你可以到
github
上clone,也可以到
PHP官网
下载。下载后解压到
/usr/local/src
目录,并将目录重命名为php7。进入目录。
配置编译参数
生成配置文件
./buildconf
配置
./configure
\
--prefix=/usr/local/php7
\
--exec-prefix=/usr/local/php7
\
--bindir=/usr/local/php7/bin
\
--sbindir=/usr/local/php7/sbin
\
--includedir=/usr/local/php7/include
\
--libdir=/usr/local/php7/lib/php
\
--mandir=/usr/local/php7/php/man
\
--with-config-file-path=/usr/local/php7/etc
\
--with-mysql-sock=/var/run/mysql/mysql.sock
\
--with-mcrypt=/usr/include
\
--with-mhash
\
--with-openssl
\
--with-mysqli=shared,mysqlnd
\
--with-pdo-mysql=shared,mysqlnd
\
--with-gd
\
--with-iconv
\
--with-zlib
\
--enable-zip
\
--enable-inline-optimization
\
--disable-debug
\
--disable-rpath
\
--enable-shared
\
--enable-xml
\
--enable-bcmath
\
--enable-shmop
\
--enable-sysvsem
\
--enable-mbregex
\
--enable-mbstring
\
--enable-ftp
\
--enable-gd-native-ttf
\
--enable-pcntl
\
--enable-sockets
\
--with-xmlrpc
\
--enable-soap
\
--without-pear
\
--with-gettext
\
--enable-session
\
--with-curl
\
--with-jpeg-dir
\
--with-freetype-dir
\
--enable-opcache
\
--enable-fpm
\
--disable-cgi
\
--with-fpm-user=nginx
\
--with-fpm-group=nginx
\
--without-gdbm
\
--disable-fileinfo
参数说明
prefix
PHP7安装的根目录
with-config-file-path
PHP7的配置文件目录
执行完上面的配置命令后的结果如下图所示:
执行上面命令的过程中会遇到一些依赖缺少的提示,下面列出我遇到的依赖问题:
错误:
configure:
error:
xml2-config
not
found.
Please
check
your
libxml2
installation.
解决:
zypper
install
libxml2-devel
错误:
configure:
WARNING:
unrecognized
options:
--with-mysql
解决:
取消这个选项,这个选项是不存在的
错误:
configure:
error:
jpeglib.h
not
found.
解决:
zypper
install
libjpeg-devel
错误:
configure:
error:
mcrypt.h
not
found.
Please
reinstall
libmcrypt.
解决:
zypper
install
libmcrypt-devel
错误:
checking
for
recode
support...
yes
configure:
error:
Can
not
find
recode.h
anywhere
under
/usr
/usr/local
/usr
/opt.
解决:
zypper
install
librecode-devel
总的来说,在配置的时候遇到没有的就打开Yast搜一下,如果有的话就安装,然后重新编译看还需要那些,如果在Yast找不到,那就上网找一下Google。
编译和安装PHP7
make
&&
make
install
其中,make之后可以选择make
test。只是一个可选步骤,不执行不知道有什么问题,不过笔者暂时还没遇到。
查看安装成功后的PHP7目录
编译安装成功后,查看PHP7的安装目录`ls
/usr/local/php7`:
设置PHP7的配置文件
cp
/usr/local/src/php7/php.ini-proction
/usr/local/php7/etc/php.ini
cp
/usr/local/src/sapi/fpm/init.d.php-fpm
/etc/init.d/php-fpm
cp
/usr/local/php7/etc/php-fpm.conf.default
/usr/local/php7/etc/php-fpm.conf
cp
/usr/local/php7/etc/php-fpm.d/www.conf.default
/usr/local/php7/etc/php-fpm.d/www.conf
设置环境变量
在/etc/profile
文件的最后一行加上
export
PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH
然后执行
source
/etc/profile
设置PHP日志目录和php-fpm进程文件(php-fpm.sock)目录
mkdir
-p
/var/log/php-fpm/
&&
mkdir
-p
/var/run/php-fpm
&&
cd
/var/run/
&&
chown
-R
nginx:nginx
php-fpm
将PHP设置为开机启动
chmod
+x
/etc/init.d/php-fpm
chkconfig
php-fpm
on
可以用chkconfig命令查看开机启动服务列表。
启动PHP服务
service
php-fpm
start
通过ps
aux
|
grep
'php'查看PHP是否启动成功
至此,PHP7就安装成功了,你也开始使用PHP7吧!

㈡ centos7系统源码编译安装PHP7.3.5版本

新增系统用户组和用户:

下载 PHP7.3.5

[root@localhost ~]# mkdir devdir

[root@localhost ~]# cd devdir/

[root@localhost devdir]# wget https://www.php.net/distributions/php-7.3.5.tar.gz

-bash: wget: 未找到命令

[root@localhost devdir]# rpm -qa|grep wget

[root@localhost devdir]# yum -y install wget

[root@localhost devdir]# rpm -qa|grep wget

wget-1.14-18.el7.x86_64

下载PHP7 解压 编译

wget -c https://downloads.php.net/~cmb/php-7.3.4.tar.gz

编译参数解释

--with-fpm-user=webu --with-fpm-group=webg 添加PHP运行用户和用户组

配置信息出错:

下载gcc软件编译器 yum install -y gcc

configure: error: libxml2 not found. Please check your libxml2 installation.

下载libzip-1.5.2.tar.gz

https://libzip.org/download/libzip-1.5.2.tar.gz

解决libzip 和cmake版本问题

重新配置PHP7编译环境参数

libzip-1.5.2 无法安装,已经取消了。

提示off_t类型没有定义 undefind,解决方法:

编译安装

测试PHP是否安装成功

转载自:https://my.oschina.net/u/4127346/blog/3047778

㈢ debian8怎么安装php7

debian8 编译安装 php7
目录(?)[-]
Please reinstall the libcurl distributionCannot find OpenSSL
configure error Unable to locate gmph
Can not find recodeh anywhere under usr usrlocal usr optCannot find pspell
Please reinstall the mysql distribution
mcrypth not found Please reinstall libmcryptxml2-config not found
安装编译器
apt-get install build-essential autoconf automake libtool bison re2c获取PHP安装包
wget https://downloads.php.net/~ab/php-7.0.13RC1.tar.gz安装dev包
apt-get install libxml2-dev libssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libmcrypt-dev libmysqlclient15-dev libpspell-dev librecode-dev进行编译安装
./buildconf //用来生成configure脚本
./configure \
--prefix=/usr \
--with-config-file-path=/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--with-t1lib=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config
备注:错误1:Cannot find OpenSSL's libraries 解决:
确认已安装过 openssl、libssl-dev 包,还是会提示该错误;解决办法:
root@test2:~/php-5.3.27# find / -name libssl.so输出结果为: /usr/lib/x86_64-Linux-gnu/libssl.so初步判断它可能只会在 /usr/lib/ 下寻找 libssl.so 文件,于是:
ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib错误2:debian Please reinstall the libcurl distribution 解决:
# RetHat CentOS or Fedora 使用下面安装命令yum install curl curl-devel
# Debian or Ubuntu使用下面的安装命令
apt-get install curl
apt-get install libcurl4-gnutls-dev
错误3:Unable to locate gmp.h 解决:
在https://launchpad.net/debian/+source/gmp 下载 gmp源码包,接着 ./configure && make && make install编译 安装
make &&make install
报错处理
Please reinstall the libcurl distributionaptitude search libcurl4
aptitude install libcurl4-gnutls-dev
Cannot find OpenSSL’
wget https://www.openssl.org/source/openssl-1.0.2j.tar.gztar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config
make && make install
configure: error: Unable to locate gmp.h
sudo apt-get install libgmp-dev libgmp3-devln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.hCan not find recode.h anywhere under /usr /usr/local /usr /opt.
apt-get install librecode-dev
Cannot find pspell
apt-get install libpspell-dev
Please reinstall the mysql distribution
apt-get install libmysqlclient15-dev
mcrypt.h not found. Please reinstall libmcrypt.
apt-get install libmcrypt-dev
xml2-config not found
apt-get install libxml2-dev

㈣ centos7怎么编译安装nginx1.95+mariadb10.1+php7

如果你nginx是rpm包安装的,直接用如下命令:
nginx -V 如果你是源码包编译安装
如果你的安装路径是/usr/local/nginx,那么你可以使用:
/usr/local/nginx/sbin/nginx -V 注意是大写的V,
这样你就可以看到nginx已经加载的模块了。

㈤ php7新建扩展时,make编译时报 unknown type name 'zend_string'

你希望用php7的环境编译,但是你编辑的环境实际上是php5的。

php5 里面没有zend_string类型,用 char 替换,或者,修改你的php版本环境到php7

㈥ Mac 编译安装php7时提示“freetype-config not found”,怎么解决

做一个链接咯
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h

㈦ centos7 php7 安装扩展phalcon 报错

第一步:在网络中搜索Phalcon,一般第一个网站,进入网站,我们点击网站首页的download,目前该框架的最近版本是2.0

接着 我们找到我们的系统 这里我建议选用二进制的源码编译安装!

然后 我们根据网站上的提示 下载该框架托管在github上面的二进制源码,如图所示,(使用git命令时需要安装yum install git)

使用putty连接我们的linux系统 在linux系统/usr/local/src/下面输入步骤三图片上的命令 稍等片刻源码就会下载下来

源码下载完毕后会有一个cphalcon目录 我们用命令行切换到/usr/local/src/cphalcon/build

用vi编辑器打开install文件 按照下图配置 选择php-config(php安装位置各有不同)默认install 没有选择php-config的位置所有我们要自己动手

编辑完成 直接执行./install 动态编译加载php扩展

编译完成后打开php.ini文件添加phalcon的扩展 在php.ini中添加下图的扩展即可

最后一步php探针验证 !大工告成!

㈧ PHP7安装intl扩展和linux安装icu

一 PHP intl 是国际化扩展,是ICU 库的一个包装器。所以在安装PHP intl扩展前要先安装ICU库,安装ICU库的具体步骤::

二 安装intl扩展
1:进入php7.2.5源码:

2:运行:phpize ,找不到命令时,将路径补全:/usr/local/php7/bin/phpize(是php的安装路径),出现如下:

Configuring for:
PHP Api Version: 20100412
Zend Mole Api No: 20100525

Zend Extension Api No: 220100525

3:运行配置

./configure --enable-intl --with-icu-dir=/usr/local/icu/ --with-php-config=/usr/local/php7/bin/php-config

注:前面路径为icu的安装路径,后面路径为php的安装路径。

4:编译扩展:make

5:复制扩展到目标文件夹

cp /user/local/php/php7.2.5/ext/intl/moles/intl.so /user/local/php7/lib/php/extensions/no-debug-non-zts-20170718

注意:也可以find / -name intl.so 查找。

6:设置扩展加入配置文件中:

[intl]
extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/"

extension=intl.so

大坑:::采用phpinfo()时,无法找到配置的intl扩展,说明配置没有生效。。。。。。

原因:在编译php时没有 --with-config-file-path=PATH 指定php.ini路径,默认的路径为/usr/local/php7/lib,只需要将php.ini放入这个默认的路径即可。你也可以安装配置php时加入,如下:

./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath -enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --enable-pcntl --with-curl --with-fpm-user=nginx --enable-ftp --enable-session --enable-xml --with-apxs2=/usr/bin/apxs
访问:index.php中phpinfo()文件。

㈨ php7 源代码加密扩展有哪些

$ wget https://codeload.github.com/liexusong/php-beast/zip/php7
$ unzip php-beast-php7.zip
$ cd php-beast-php7
$ phpize
$ ./configure
$ sudo make && make install

编译好之后修改php.ini配置文件, 加入配置项: extension=beast.so, 重启php-fpm

阅读全文

与源码编译php7相关的资料

热点内容
中国移动长沙dns服务器地址 浏览:249
wifi密码加密了怎么破解吗 浏览:596
linux命令cpu使用率 浏览:67
linux实用命令 浏览:238
传奇引擎修改在线时间命令 浏览:109
php取域名中间 浏览:897
cad命令栏太小 浏览:830
php开发环境搭建eclipse 浏览:480
qt文件夹名称大全 浏览:212
金山云服务器架构 浏览:230
安卓系统笔记本怎么切换系统 浏览:618
u盘加密快2个小时还没有搞完 浏览:93
小米有品商家版app叫什么 浏览:94
行命令调用 浏览:436
菜鸟裹裹员用什么app 浏览:273
穷查理宝典pdf下载 浏览:514
csgo您已被禁用此服务器怎么办 浏览:398
打开加密软件的方法 浏览:156
云存储服务器可靠吗 浏览:967
2核1g的云服务器能带动游戏嘛 浏览:898