Debian: php and php5

kRYOoX

I'm running a small private Debian Jessie server, acting as a private cloud / hosting platform.

Often times, I've faced 'difficulties' installing services with recent PHP requirements because, while most documentations tell you to call php in a certain manner (to install composer for instance), I actually have to call php5. And if it were just that, I could easily handle it, but I do not always entirely control what binary is used without having to rework lots of scripts and so on.

$ php5 -v
PHP 5.6.20-0+deb8u1 (cli) (built: Apr 27 2016 11:26:05) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

$ php -v 
PHP 5.5.15 (cli) (built: Oct  4 2014 14:03:37) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Both binaries point to different versions of PHP, and I don't understand why. When I list my installed packages there's only one php.

php-auth/stable,now 1.6.4-1 all [installed]
php-auth-sasl/stable,now 1.0.6-1+deb8u1 all [installed,automatic]
php-db/stable,now 1.7.14-3 all [installed,automatic]
php-gettext/stable,now 1.0.11-1 all [installed,automatic]
php-http-request/stable,now 1.4.4-4 all [installed,automatic]
php-log/stable,now 1.12.8-2 all [installed,automatic]
php-mail/stable,now 1.2.0-7 all [installed,automatic]
php-mail-mime/stable,now 1.8.9-1+deb8u1 all [installed,automatic]
php-mdb2/stable,now 2.5.0b5-1 all [installed,automatic]
php-net-dime/stable,now 1.0.2-2 all [installed,automatic]
php-net-smtp/stable,now 1.6.2-2 all [installed,automatic]
php-net-socket/stable,now 1.0.14-1 all [installed,automatic]
php-net-url/stable,now 1.0.15-3 all [installed,automatic]
php-pear/stable,now 5.6.20+dfsg-0+deb8u1 all [installed]
php-soap/stable,now 0.13.0-1 all [installed,automatic]
php-tcpdf/stable,now 6.0.093+dfsg-1 all [installed,automatic]
php-xml-parser/stable,now 1.3.4-7 all [installed,automatic]
php5/stable,now 5.6.20+dfsg-0+deb8u1 all [installed]             <--- HERE
php5-apcu/stable,now 4.0.7-1 amd64 [installed]
php5-cgi/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-cli/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-common/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-curl/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-gd/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-imagick/stable,now 3.2.0~rc1-1 amd64 [installed]
php5-imap/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-intl/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-json/stable,now 1.3.6-1 amd64 [installed,automatic]
php5-ldap/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed,automatic]
php5-mcrypt/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-memcache/stable,now 3.0.8-5 amd64 [installed]
php5-memcached/stable,now 2.2.0-2 amd64 [installed]
php5-mysql/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-pgsql/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed,automatic]
php5-pspell/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-readline/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed,automatic]
php5-recode/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-sqlite/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-tidy/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-xmlrpc/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]
php5-xsl/stable,now 5.6.20+dfsg-0+deb8u1 amd64 [installed]

I'm hoping someone can explain why 2 versions of PHP coexist on my server and if there's anyway I can make sure that php points to the php5 package I've installed as a default.

Thank you.

peterh - Reinstate Monica

It is bad, something is not okay in your system.

On the debian way, /usr/bin/php should be a symlink to /etc/alternatives/php, which should be a symlink to /usr/bin/php5. Thus, if you get different version informations for the command php and php5, it is bad.

This alternatives thing enables you to have simultanously different php versions on the same system. For example, you could have php4 and php5. But, different versions of php5, you can't have, these packages are eachothers replacements.

I think, sometimes a source-based, or non-debianic php install happened on your system, which wasted your /usr/bin/php. On debian jessie, it must be a symbolic link as I wrote above.

Your problems result from this. I suggest to remove the non-debian php version, and do a dist-upgrade. Maybe some system cleanup would be also useful, that non-debianic php install probably installed other files as well.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Debian Wheezy, php5 / apache가 설치되었지만 php 파일이 일반 텍스트로 표시됨

분류에서Dev

Spreadsheet_Excel_Writer for Php5

분류에서Dev

Upgrade PCRE version on Ubuntu with PHP5

분류에서Dev

php5 $ _SESSION 보안

분류에서Dev

PHP5에 SqLite 추가

분류에서Dev

Purpose of php and php5 directories in /usr/share

분류에서Dev

PHP5를 사용한 VSCode

분류에서Dev

php5에서 https 사용

분류에서Dev

php5에서 .zip 파일 압축

분류에서Dev

I'm getting this error when try to update to php5

분류에서Dev

I'm unable to install PHP5 in Ubuntu 16.04

분류에서Dev

Ubuntu 18.04에 PHP5 설치

분류에서Dev

Debian Squeeze에 php5-fpm 설치

분류에서Dev

php4 클래스를 php5로 변환 : "var $ thisvar;"대체 도움말 php5 equivilant로

분류에서Dev

php 5.6.20-/etc/php5/conf.d 디렉토리 누락

분류에서Dev

PHP5 대 PHP7을 사용하는 ZF2

분류에서Dev

우분투 13.10에서 php5 5.5.3을 php5 5.3으로 다운 그레이드

분류에서Dev

Debian 7.11 (wheezy) 및 PHP 7.0

분류에서Dev

php5 및 phpmyadmin이 설치되지 않음

분류에서Dev

how to correctly install apache2, php5, mysql and phpmyadmin

분류에서Dev

php5 ini 파일이 비어 있습니다.

분류에서Dev

Apache / PHP5 popen / fread는 Apache를 연결합니다.

분류에서Dev

Ubuntu 16.04에 php5를 설치할 수 없습니다.

분류에서Dev

php5 및 phpmyadmin이 설치되지 않음

분류에서Dev

HHVM 또는 PHP5 Zend가 실행되고 있습니까?

분류에서Dev

PHP5 용 인공 신경망 재 학습

분류에서Dev

Install xdebug in Ubuntu 16 with php5 - error: can't read ltmain.sh

분류에서Dev

/usr/share/php5/php.ini-development 파일을 찾을 수 없습니다.

분류에서Dev

ppa : ondrej / php5에서 예상치 못한 PHP 버전 5.5.15rc1

Related 관련 기사

뜨겁다태그

보관