剛開始用LINUX沒什麼經驗,CentOS 6.5自帶PHP5,當時不會刪就留著了,然後安裝了PHP7. 現在查看php -v結果顯示的是PHP 5.6. 怎麼讓系統預設使用PHP7呢?
剛剛把PHP全刪了“yum remove php*”,然後用YUM安裝了PHP7,現在php -v顯示是PHP 7了。
但是運行php-fpm的時候提示找不到檔案。我又用yum --enablerepo=remi install php php-fpm 安裝了一下php-fpm,執行後提示:
yum install php php-fpm php-mysql
Failed to set locale, defaulting to C
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-48.el6_8 for package: php-5.3.3-48.el6_8.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.3-48.el6_8 for package: php-5.3.3-48.el6_8.x86_64
---> Package php-fpm.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package php-mysql.x86_64 0:5.3.3-48.el6_8 will be installed
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-48.el6_8 will be installed
---> Package php-common.x86_64 0:5.3.3-48.el6_8 will be installed
--> Processing Conflict: php70w-common-7.0.15-1.w6.x86_64 conflicts php-common < 7.0
--> Finished Dependency Resolution
Error: php70w-common conflicts with php-common-5.3.3-48.el6_8.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
運行php-fpm依然提示「-bash: /usr/sbin/php-fpm: No such file or directory」
再試這個安裝:
yum install php70-php-fpm.x86_64
Failed to set locale, defaulting to C
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php70-php-fpm.x86_64 0:7.0.15-1.el6.remi will be installed
--> Processing Dependency: php70-php-common(x86-64) = 7.0.15-1.el6.remi for package: php70-php-fpm-7.0.15-1.el6.remi.x86_64
--> Running transaction check
---> Package php70-php-common.x86_64 0:7.0.15-1.el6.remi will be installed
--> Processing Dependency: php70-php-json(x86-64) = 7.0.15-1.el6.remi for package: php70-php-common-7.0.15-1.el6.remi.x86_64
--> Processing Dependency: php70-runtime for package: php70-php-common-7.0.15-1.el6.remi.x86_64
--> Running transaction check
---> Package php70-php-json.x86_64 0:7.0.15-1.el6.remi will be installed
---> Package php70-runtime.x86_64 0:1.0-5.el6.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php70-php-fpm x86_64 7.0.15-1.el6.remi remi-safe 1.4 M
Installing for dependencies:
php70-php-common x86_64 7.0.15-1.el6.remi remi-safe 582 k
php70-php-json x86_64 7.0.15-1.el6.remi remi-safe 55 k
php70-runtime x86_64 1.0-5.el6.remi remi-safe 1.0 M
Transaction Summary
================================================================================
Install 4 Package(s)
Total download size: 3.0 M
Installed size: 8.0 M
Is this ok [y/N]: y
Downloading Packages:
http://rpms.remirepo.net/enterprise/6/safe/x86_64/php70-php-common-7.0.15-1.el6.remi.x86_64.rpm: [Errno 12] Timeout on http://rpms.remirepo.net/enterprise/6/safe/x86_64/php70-php-common-7.0.15-1.el6.remi.x86_64.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 3 seconds')
Trying other mirror.
(1/4): php70-php-common-7.0.15-1.el6.remi.x86_64.rpm | 582 kB 00:43
http://fr2.rpmfind.net/linux/remi/enterprise/6/safe/x86_64/php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm: [Errno 12] Timeout on http://fr2.rpmfind.net/linux/remi/enterprise/6/safe/x86_64/php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 3 seconds')
Trying other mirror.
http://mirrors.mediatemple.net/remi/enterprise/6/safe/x86_64/php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm: [Errno 12] Timeout on http://mirrors.mediatemple.net/remi/enterprise/6/safe/x86_64/php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 3 seconds')
Trying other mirror.
http://remi.mirrors.arminco.com/enterprise/6/safe/x86_64/php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm: [Errno 12] Timeout on http://remi.mirrors.arminco.com/enterprise/6/safe/x86_64/php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm: (28, 'connect() timed out!')
Trying other mirror.
(2/4): php70-php-fpm-7.0.15-1.el6.remi.x86_64.rpm | 1.4 MB 01:56
(3/4): php70-php-json-7.0.15-1.el6.remi.x86_64.rpm | 55 kB 00:06
http://remi.schlundtech.de/enterprise/6/safe/x86_64/php70-runtime-1.0-5.el6.remi.x86_64.rpm: [Errno 12] Timeout on http://remi.schlundtech.de/enterprise/6/safe/x86_64/php70-runtime-1.0-5.el6.remi.x86_64.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 3 seconds')
Trying other mirror.
(4/4): php70-runtime-1.0-5.el6.remi.x86_64.rpm | 1.0 MB 00:02
--------------------------------------------------------------------------------
Total 8.2 kB/s | 3.0 MB 06:16
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php70-runtime-1.0-5.el6.remi.x86_64 1/4
Installing : php70-php-common-7.0.15-1.el6.remi.x86_64 2/4
Installing : php70-php-json-7.0.15-1.el6.remi.x86_64 3/4
Installing : php70-php-fpm-7.0.15-1.el6.remi.x86_64 4/4
Unable to connect to dbus
Verifying : php70-php-json-7.0.15-1.el6.remi.x86_64 1/4
Verifying : php70-php-common-7.0.15-1.el6.remi.x86_64 2/4
Verifying : php70-php-fpm-7.0.15-1.el6.remi.x86_64 3/4
Verifying : php70-runtime-1.0-5.el6.remi.x86_64 4/4
Installed:
php70-php-fpm.x86_64 0:7.0.15-1.el6.remi
Dependency Installed:
php70-php-common.x86_64 0:7.0.15-1.el6.remi
php70-php-json.x86_64 0:7.0.15-1.el6.remi
php70-runtime.x86_64 0:1.0-5.el6.remi
Complete!
運行 php-fpm
顯示
-bash: php-fpm: command not found
該怎麼解決呢?
安裝完php-fpm後,最後提示
--> Finished Dependency Resolution
Error: php70w-common conflicts with php-common-5.3.3-48.el6_8.x86_64
You could try using --skip-broken to work around the projblem -Va --nofiles --nodigest
開啟php-fpm:service php-fpm start
使用php命令列模式: php 執行檔