CentOS 6.5怎么安装PHP-FPM?

【字号: 日期:2022-08-09浏览:42作者:雯心

问题描述

刚开始用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-mysqlFailed to set locale, defaulting to CLoaded plugins: refresh-packagekit, securitySetting up Install ProcessResolving 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 ResolutionError: 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 CLoaded plugins: refresh-packagekit, securitySetting up Install ProcessResolving 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 ResolutionDependencies Resolved================================================================================ Package ArchVersion Repository Size================================================================================Installing: php70-php-fpm x86_64 7.0.15-1.el6.remi remi-safe 1.4 MInstalling for dependencies: php70-php-common x86_64 7.0.15-1.el6.remi remi-safe 582 k php70-php-jsonx86_64 7.0.15-1.el6.remi remi-safe 55 k php70-runtime x86_64 1.0-5.el6.remi remi-safe 1.0 MTransaction Summary================================================================================Install 4 Package(s)Total download size: 3.0 MInstalled size: 8.0 MIs this ok [y/N]: yDownloading 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:43http://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:06http://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:16Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning 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/4Unable 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/4Installed: php70-php-fpm.x86_64 0:7.0.15-1.el6.remiDependency 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.remiComplete!

运行 php-fpm显示-bash: php-fpm: command not found

该怎么解决呢?

安装完php-fpm之后,最后提示

--> Finished Dependency ResolutionError: 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

感觉是PHP5没删干净,跟PHP7冲突。 怎么删掉 php-common-5.3.3-48.el6_8.x86_64 ?

问题解答

回答1:

开启php-fpm:service php-fpm start使用php命令行模式: php 执行文件

相关文章: