我的 Ubuntu 12.04 LTS 服务器使用的是 PHP 5.4。然后我使用这个升级到了 PHP 5.6如何将 PHP 版本升级到最新稳定发布版本?说明。安装过程中没有显示任何错误,重新启动服务器。
php -v
节目
PHP 5.6.24-1+deb.sury.org~precise+1 (cli)
phpinfo
节目5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1
dpkg -l '*php5*'
输出:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==========================-==========================-====================================================================
ii libapache2-mod-php5 5.4.45-4+deprecated+dontus server-side, HTML-embedded scripting language (Apache 2 module)
un libapache2-mod-php5.6 <none> (no description available)
un libapache2-mod-php5filter <none> (no description available)
un libow-php5 <none> (no description available)
ii php5 5.4.45-4+deprecated+dontus server-side, HTML-embedded scripting language (metapackage)
un php5-cgi <none> (no description available)
ii php5-cli 5.4.45-4+deprecated+dontus command-line interpreter for the php5 scripting language
ii php5-common 5.4.45-4+deprecated+dontus Common files for packages built from the php5 source
ii php5-curl 5.4.45-4+deprecated+dontus CURL module for php5
ii php5-fpm 5.4.45-4+deprecated+dontus server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php5-gd 5.4.45-4+deprecated+dontus GD module for php5
un php5-gpib <none> (no description available)
un php5-idn <none> (no description available)
ii php5-intl 5.4.45-4+deprecated+dontus internationalisation module for php5
un php5-json <none> (no description available)
ii php5-mcrypt 5.4.45-4+deprecated+dontus MCrypt module for php5
un php5-mhash <none> (no description available)
ii php5-mysql 5.4.45-4+deprecated+dontus MySQL module for php5
un php5-mysqli <none> (no description available)
un php5-mysqlnd <none> (no description available)
ii php5-pgsql 5.4.45-4+deprecated+dontus PostgreSQL module for php5
ii php5-readline 5.4.45-4+deprecated+dontus Readline module for php5
un php5-suhosin <none> (no description available)
ii php5.6 5.6.24-1+deb.sury.org~prec server-side, HTML-embedded scripting language (metapackage)
un php5.6-calendar <none> (no description available)
un php5.6-cgi <none> (no description available)
ii php5.6-cli 5.6.24-1+deb.sury.org~prec command-line interpreter for the PHP scripting language
ii php5.6-common 5.6.24-1+deb.sury.org~prec documentation, examples and common module for PHP
un php5.6-ctype <none> (no description available)
un php5.6-exif <none> (no description available)
un php5.6-fileinfo <none> (no description available)
ii php5.6-fpm 5.6.24-1+deb.sury.org~prec server-side, HTML-embedded scripting language (FPM-CGI binary)
un php5.6-ftp <none> (no description available)
un php5.6-gettext <none> (no description available)
un php5.6-iconv <none> (no description available)
ii php5.6-json 5.6.24-1+deb.sury.org~prec JSON module for PHP
ii php5.6-opcache 5.6.24-1+deb.sury.org~prec Zend OpCache module for PHP
un php5.6-pdo <none> (no description available)
un php5.6-phar <none> (no description available)
un php5.6-posix <none> (no description available)
ii php5.6-readline 5.6.24-1+deb.sury.org~prec readline module for PHP
un php5.6-shmop <none> (no description available)
un php5.6-sockets <none> (no description available)
un php5.6-sysvmsg <none> (no description available)
un php5.6-sysvsem <none> (no description available)
un php5.6-sysvshm <none> (no description available)
un php5.6-tokenizer <none> (no description available)
我应该怎么做才能使 apache2 使用我想要的正确 PHP 版本 5.6?
谢谢
答案1
如dpkg -l
输出所示,您的 Apache PHP 模块(包libapache2-mod-php5
)的版本为 5.4。您应该安装包libapache2-mod-php5.6
,这将安装版本 5.6。可能需要先删除libapache2-mod-php5
。(您可能还想删除所有其他php5-*
属于 PHP 5.4 的包,但这不是必需的。)