如何在Ubuntu上安装PHP 7(PHP下一代)

如何在Ubuntu上安装 PHP 7(PHP下一代)?

我想在一个干净安装的Ubuntu上安装PHP 7,看看我会面对什么问题.

这是官方(但微薄的指南):

https://wiki.php.net/phpng

我自己做了一个事情,认为记录我遇到的问题是有用的,我如何克服这些问题,从而拯救他人或许有些痛苦和痛苦.

我之前(事实之后)发现这个http://jcutrer.com/howto/linux/how-to-compile-php7-on-ubuntu-14-04这是一个比我以下提供的清洁指南.

从指南(https://wiki.php.net/phpng):

./buildconf 
mkdir  ~/tmp 
cd ~/tmp
git clone https://git.PHP.net/repository/PHP-src.git
cd PHP-src

到现在为止还挺好.此时我开始出现问题:

./buildconf即可

报告说我没有安装.解决方在这里找到:
https://askubuntu.com/questions/192645/make-command-not-found

我试过这个,但仍然有问题,所以我这样做:

sudo apt-get purge make  
sudo apt-get install make

一个问题,当我再次尝试./buildconf它抱怨我没有autoconfig.这是解决方案:

sudo apt-get install autoconf

现在终于要运行./configure命令并得到这个:

configure: WARNING: You will need re2c 0.13.4 or later if you want to
regenerate PHP parsers. configure: error: bison is required to build
PHP/Zend when building a GIT checkout!

安装Bison也似乎安装re2c,所以这修复了这两个问题:

sudo apt-get install bison

配置搅拌了很长一段时间,然后用:

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

应该是一个很容易解决的权利?赶紧跑:

sudo apt-get install libxml2

不.不是那么容易我们已经有了最新的和最伟大的:

libxml2 is already the newest version.

好的.也许我们可以像我们做的那样解决这个问题,并清理并重新安装:

sudo apt-get purge libxml2
sudo apt-get install libxml2

不.在同一个错误上运行./configure barfs.为了救援:

How to fix error with xml2-config not found when installing PHP from sources?

显然,我们需要这个库的开发版本:

sudo apt-get install libxml2-dev

./configure再次,我们有进展…一个新的错误

configure: error: Cannot find OpenSSL’s

从我们最后一次的学习中我们来试试看:

sudo apt-get install openssl-dev

要么

sudo apt-get install open-ssl-dev

不,好吧,我们来搜索一下:

apt-cache search openssl

哇,这是很多包.让我们缩小一点:

apt-cache search openssl | grep PHP

那给我们一个较小的列表,但都有PHP5在前面,我们正在做一个PHP7(从头开始的下一代PHPng);这些包中的任何一个工作吗?关于我们的解决方案的interwebs:

https://serverfault.com/questions/415458/php-error-cannot-find-openssls-evp-h

sudo apt-get install libcurl4-openssl-dev pkg-config

让我们看看是否这样做./configure happy(不,但进度…一个新的错误):

configure: error: Please reinstall the BZip2 distribution

搜索网页再次导致我们:

http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204

这告诉我们这样做:

sudo apt-get install libbz2-dev

我们再次向./configure神和…发送祈祷

If configure fails try –with-vpx-dir=
configure: error: jpeglib.h not found.

到INTERWEBS!

发现这个:http://www.omniweb.com/wordpress/?p=1040

sudo apt-get install libjpeg-dev

再次尝试./configure并调查SAYS:

configure: error: png.h not found.

从与上述相同的网站说,这样做:

sudo apt-get install libpng-dev

尝试./configure AGAIN和SURVEY SAYS:

configure error xpm.h not found

我在黑暗中刺伤了一个刺,

sudo apt-get install libxpm-dev

再次向./configure神祈祷,答复是:

configure: error: freetype-config not found.

所有知道的Google都在这里指导我们:

Configure php 5.3 fail with error : freetype.h not found (but libfreetype6-dev is installed)

sudo apt-get install libfreetype6-dev

现在你可能已经认识到了:

>运行./configure
>搜索你最喜欢的搜索引擎或直接的错误信息
在SO上.
>通过apt-get安装缺少的组件.
> GOTO 1.

所以从这里我只是要显示错误和apt-get命令或其他解决问题的命令:

configure: error: Unable to locate gmp.h

build php5.3.8 on ubuntu,get error: configure: error: Unable to locate gmp.h

sudo apt-get install libgmp-dev  
sudo apt-get install libgmp3-dev
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

sudo apt-get install libmcrypt-dev

configure: error: Please reinstall the MysqL distribution

http://www.spiration.co.uk/post/1332/install%20PDO_MYSQL%20-%20mysql_config%20and%20header%20files%20problem

sudo apt-get install libMysqLclient15-dev

configure: error: Cannot find pspell

sudo apt-get install libpspell-dev

configure: error: Can not find recode.h anywhere under /usr /
usr/local /usr /opt.

sudo apt-get install librecode-dev

configure: WARNING: unrecognized options: –with-t1lib

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658248

没有解决方案.似乎是一个回归错误.解决办法是从配置选项中删除–with-t1lib.我认为这可能仅适用于Windows版本,但我不确定.

configure: WARNING: unrecognized options: –with-my-sql

没有解决方案.解决办法是从配置选项中删除–with-MysqL开关.由于我们包括pdo-MysqL,这可能不是一个问题.

最后我们通过这个命令实际构建PHP7(我建议你现在自己一杯咖啡,因为这需要一些时间):

make

使用命令sudo make install来实际安装我们的PHP build:

sudo make install

检查一切是否正常,我们有正确的版本在终端中执行:

cd $HOME/tmp/usr/bin
./PHP -v

PHP 7.0.0-dev (cli) (built: Jun 22 2015 18:11:13) copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0-dev,copyright (c) 1998-2015 Zend Technologies

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...