安装phpize7.3

编程

1,背景

在现有的ubuntu16.04中,装了好几个版本的PHP

/etc/php/

5.6/ 7.0/ 7.1/ 7.2/ 7.3/

whereis php

php: /usr/bin/php7.3 /usr/bin/php7.0 /usr/bin/php /usr/lib/php /etc/php /usr/include/php

/usr/share/php7.3-bcmath /usr/share/php7.3-readline /usr/share/php7.3-zip

/usr/share/php7.0-common /usr/share/php7.0-opcache

/usr/share/php7.3-ldap /usr/share/php7.3-opcache /usr/share/php7.3-xml /usr/share/php7.3-mysql

/usr/share/php7.3-json /usr/share/php7.3-gd

/usr/share/php7.0-json /usr/share/php /usr/share/php7.3-curl /usr/share/php7.3-mbstring /usr/share/php7.0-mcrypt /usr/share/php7.3-common

/usr/share/php7.0-readline /usr/share/php7.3-xmlrpc /usr/share/man/man1/php.1.gz

sudo update-alternatives --config php

There are 2 choices for the alternative php (providing /usr/bin/php).

Selection Path Priority Status

------------------------------------------------------------

0 /usr/bin/php7.3 73 auto mode

1 /usr/bin/php7.0 70 manual mode

* 2 /usr/bin/php7.3 73 manual mode

Press <enter> to keep the current choice[*], or type selection number:

php -v

PHP 7.3.6-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:06:26) ( NTS )

Copyright (c) 1997-2018 The PHP Group

Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies

with Zend OPcache v7.3.6-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

但是phpize却一直是老的版本

whereis phpize

phpize: /usr/bin/phpize7.0 /usr/bin/phpize /usr/share/man/man1/phpize.1.gz

phpize

Configuring for:

PHP Api Version: 20151012

Zend Module Api No: 20151012

Zend Extension Api No: 320151012

phpize7.0

Configuring for:

PHP Api Version: 20151012

Zend Module Api No: 20151012

Zend Extension Api No: 320151012

当前PHP版本是7.3,而编译器时7.0版本,当要编译安装一些7.0以上版本时,就报错,如下:

cd swoole-src &&

phpize &&

Configuring for:

PHP Api Version: 20151012

Zend Module Api No: 20151012

Zend Extension Api No: 320151012

./configure &&

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

checking for cc... cc

checking whether the C compiler works... yes

...

config.status: creating config.h

config.status: config.h is unchanged

config.status: executing libtool commands

make && sudo make install

/bin/bash /opt/wwwroot/swoole/libtool --mode=compile g++ -I. -I/opt/wwwroot/swoole -DPHP_ATOM_INC -I/opt/wwwroot/swoole/include -I/opt/wwwroot/swoole/main -I/opt/wwwroot/swoole -I/usr/include/php/20151012

-I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib

-I/opt/wwwroot/swoole -I/opt/wwwroot/swoole/include -I/opt/wwwroot/swoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /opt/wwwroot/swoole/php_swoole_cxx.cc -o php_swoole_cxx.lo

libtool: compile: g++ -I. -I/opt/wwwroot/swoole -DPHP_ATOM_INC -I/opt/wwwroot/swoole/include -I/opt/wwwroot/swoole/main -I/opt/wwwroot/swoole -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/opt/wwwroot/swoole -I/opt/wwwroot/swoole/include -I/opt/wwwroot/swoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /opt/wwwroot/swoole/php_swoole_cxx.cc -fPIC -DPIC -o .libs/php_swoole_cxx.o

In file included from /opt/wwwroot/swoole/php_swoole_cxx.h:19:0,

from /opt/wwwroot/swoole/php_swoole_cxx.cc:1:

/opt/wwwroot/swoole/php_swoole.h:123:2: error: #error "require PHP version 7.1 or later"

#error "require PHP version 7.1 or later"

^

Makefile:194: recipe for target "php_swoole_cxx.lo" failed

make: *** [php_swoole_cxx.lo] Error 1

所以,需要为7.1或者7.3安装phpize,我们这里就以7.3为例了。

 

2,安装

直接执行命令

sudo apt-get install php7.3-dev

执行中

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following package was automatically installed and is no longer required:

snapd-login-service

Use "sudo apt autoremove" to remove it.

The following additional packages will be installed:

libapache2-mod-php7.3 libpcre2-16-0 libpcre2-32-0 libpcre2-8-0 libpcre2-dev libpcre2-posix2 php7.3-bcmath php7.3-cli php7.3-common php7.3-curl php7.3-fpm php7.3-gd php7.3-json php7.3-ldap

php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-readline php7.3-xml php7.3-xmlrpc php7.3-zip

Suggested packages:

dh-php

The following NEW packages will be installed:

libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix2 php7.3-dev

The following packages will be upgraded:

libapache2-mod-php7.3 libpcre2-8-0 php7.3-bcmath php7.3-cli php7.3-common php7.3-curl php7.3-fpm php7.3-gd php7.3-json php7.3-ldap php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-readline

php7.3-xml php7.3-xmlrpc php7.3-zip

17 upgraded, 5 newly installed, 0 to remove and 119 not upgraded.

Need to get 7,860 kB of archives.

After this operation, 9,513 kB of additional disk space will be used.

Do you want to continue? [Y/n] Y

需要空间,问是否继续,Y

Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.3-zip amd64 7.3.18-1+ubuntu16.04.1+deb.sury.org+1 [20.3 kB]

Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.3-json amd64 7.3.18-1+ubuntu16.04.1+deb.sury.org+1 [18.0 kB]

...

Setting up php7.3-cli (7.3.18-1+ubuntu16.04.1+deb.sury.org+1) ...

由于原先已经安装了php7.3版本,所以会弹窗,询问对php.ini文件的处理

一般会选择的第二个,保留已安装过的版本。但是我自己想用新的,所以选了第一个。

Installing new version of config file /etc/init.d/php7.3-fpm ...

接着又询问关于 php-fpm.conf (也会上面的弹框)

以及 www.conf 配置文件的处理:

Configuration file "/etc/php/7.3/fpm/pool.d/www.conf"

==> Modified (by you or by a script) since installation.

==> Package distributor has shipped an updated version.

What would you like to do about it ? Your options are:

Y or I : install the package maintainer"s version

N or O : keep your currently-installed version

D : show the differences between the versions

Z : start a shell to examine the situation

The default action is to keep your current version.

*** www.conf (Y/I/N/O/D/Z) [default=N] ? Y

这边仍然选择重新安装。

Installing new version of config file /etc/php/7.3/fpm/pool.d/www.conf ...

Replacing config file /etc/php/7.3/fpm/php.ini with new version

NOTICE: Not enabling PHP 7.3 FPM by default.

NOTICE: To enable PHP 7.3 FPM in Apache2 do:

NOTICE: a2enmod proxy_fcgi setenvif

NOTICE: a2enconf php7.3-fpm

NOTICE: You are seeing this message because you have apache2 package installed.

.

.

.

NOTICE: Not enabling PHP 7.3 FPM by default.

NOTICE: To enable PHP 7.3 FPM in Apache2 do:

NOTICE: a2enmod proxy_fcgi setenvif

NOTICE: a2enconf php7.3-fpm

NOTICE: You are seeing this message because you have apache2 package installed.

看一下phpize

whereis phpize

phpize: /usr/bin/phpize7.0 /usr/bin/phpize /usr/bin/phpize7.3 /usr/share/man/man1/phpize.1.gz

phpize7.3

Configuring for:

PHP Api Version: 20180731

Zend Module Api No: 20180731

Zend Extension Api No: 320180731

autoconf: warning: both `configure.ac" and `configure.in" are present.

autoconf: warning: proceeding with `configure.ac".

autoheader: "configure.ac" and "configure.in" both present.

autoheader: proceeding with "configure.ac"

已经安装好了。

以上是 安装phpize7.3 的全部内容, 来源链接: utcz.com/z/517086.html

回到顶部