Linuxでのphpインストール手順

11541 ワード

この文は、徐実操が使ったLinux発行版centos 6.x
1.php 5.6のソースを追加
CentOs 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2.使用可能なインストールパッケージを確認[www@istester ~]
3.php 5をインストールする.6
1)コマンドyum install php 56 w php 56 w-mysql php 56 w-mbstring php 56 w-mcrypt php 56 w-gd php 56 w-imap php 56 w-ldap php 56 w-odbc php 56 w-pear php 56 w-xml php 56 w-xmlrpc php 56 w-pdo
2)インストール手順[root@istester www]# yum install php56w php56w-mysql php56w-mbstring php56w-mcrypt php56w-gd php56w-imap php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-pdo Loaded plugins: security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php56w.x86_64 0:5.6.40-1.w6 will be installed --> Processing Dependency: php56w-common(x86-64) = 5.6.40-1.w6 for package: php56w-5.6.40-1.w6.x86_64 --> Processing Dependency: php56w-cli(x86-64) = 5.6.40-1.w6 for package: php56w-5.6.40-1.w6.x86_64 --> Processing Dependency: php56w-cli = 5.6.40-1.w6 for package: php56w-5.6.40-1.w6.x86_64 ---> Package php56w-gd.x86_64 0:5.6.40-1.w6 will be installed --> Processing Dependency: libt1.so.5()(64bit) for package: php56w-gd-5.6.40-1.w6.x86_64 ---> Package php56w-imap.x86_64 0:5.6.40-1.w6 will be installed --> Processing Dependency: libc-client.so.2007()(64bit) for package: php56w-imap-5.6.40-1.w6.x86_64 ---> Package php56w-ldap.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-mbstring.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-mcrypt.x86_64 0:5.6.40-1.w6 will be installed --> Processing Dependency: libmcrypt.so.4()(64bit) for package: php56w-mcrypt-5.6.40-1.w6.x86_64 ---> Package php56w-mysql.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-odbc.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-pdo.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-pear.noarch 1:1.10.4-1.w6 will be installed --> Processing Dependency: php56w-posix for package: 1:php56w-pear-1.10.4-1.w6.noarch ---> Package php56w-xml.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-xmlrpc.x86_64 0:5.6.40-1.w6 will be installed --> Running transaction check ---> Package libc-client.x86_64 0:2007e-11.el6 will be installed ---> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed ---> Package php56w-cli.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-common.x86_64 0:5.6.40-1.w6 will be installed ---> Package php56w-process.x86_64 0:5.6.40-1.w6 will be installed ---> Package t1lib.x86_64 0:5.1.2-6.el6_2.1 will be installed --> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================== Installing: php56w x86_64 5.6.40-1.w6 webtatic 2.7 M php56w-gd x86_64 5.6.40-1.w6 webtatic 144 k php56w-imap x86_64 5.6.40-1.w6 webtatic 55 k php56w-ldap x86_64 5.6.40-1.w6 webtatic 39 k php56w-mbstring x86_64 5.6.40-1.w6 webtatic 948 k php56w-mcrypt x86_64 5.6.40-1.w6 webtatic 27 k php56w-mysql x86_64 5.6.40-1.w6 webtatic 113 k php56w-odbc x86_64 5.6.40-1.w6 webtatic 54 k php56w-pdo x86_64 5.6.40-1.w6 webtatic 96 k php56w-pear noarch 1:1.10.4-1.w6 webtatic 353 k php56w-xml x86_64 5.6.40-1.w6 webtatic 152 k php56w-xmlrpc x86_64 5.6.40-1.w6 webtatic 46 k Installing for dependencies: libc-client x86_64 2007e-11.el6 base 515 k libmcrypt x86_64 2.5.8-9.el6 epel 96 k php56w-cli x86_64 5.6.40-1.w6 webtatic 2.6 M php56w-common x86_64 5.6.40-1.w6 webtatic 1.2 M php56w-process x86_64 5.6.40-1.w6 webtatic 37 k t1lib x86_64 5.1.2-6.el6_2.1 base 160 k
Transaction Summary
Install 18 Package(s)
Total download size: 9.3 M Installed size: 35 M Is this ok [y/N]: y Downloading Packages: (1/18): libc-client-2007e-11.el6.x86_64.rpm | 515 kB 00:00 (2/18): libmcrypt-2.5.8-9.el6.x86_64.rpm | 96 kB 00:00 (3/18): php56w-5.6.40-1.w6.x86_64.rpm | 2.7 MB 00:02 (4/18): php56w-cli-5.6.40-1.w6.x86_64.rpm | 2.6 MB 00:01 (5/18): php56w-common-5.6.40-1.w6.x86_64.rpm | 1.2 MB 00:00 (6/18): php56w-gd-5.6.40-1.w6.x86_64.rpm | 144 kB 00:00 (7/18): php56w-imap-5.6.40-1.w6.x86_64.rpm | 55 kB 00:00 (8/18): php56w-ldap-5.6.40-1.w6.x86_64.rpm | 39 kB 00:00 (9/18): php56w-mbstring-5.6.40-1.w6.x86_64.rpm | 948 kB 00:00 (10/18): php56w-mcrypt-5.6.40-1.w6.x86_64.rpm | 27 kB 00:00 (11/18): php56w-mysql-5.6.40-1.w6.x86_64.rpm | 113 kB 00:00 (12/18): php56w-odbc-5.6.40-1.w6.x86_64.rpm | 54 kB 00:00 (13/18): php56w-pdo-5.6.40-1.w6.x86_64.rpm | 96 kB 00:00 (14/18): php56w-pear-1.10.4-1.w6.noarch.rpm | 353 kB 00:00 (15/18): php56w-process-5.6.40-1.w6.x86_64.rpm | 37 kB 00:00 (16/18): php56w-xml-5.6.40-1.w6.x86_64.rpm | 152 kB 00:00 (17/18): php56w-xmlrpc-5.6.40-1.w6.x86_64.rpm | 46 kB 00:00 (18/18): t1lib-5.1.2-6.el6_2.1.x86_64.rpm | 160 kB 00:00
Total 989 kB/s | 9.3 MB 00:09 warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el6 Importing GPG key 0xCF4C4FF9: Userid : Webtatic EL6 [email protected] Package: webtatic-release-6-9.noarch (installed) From :/etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el6 Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installing : php56w-common-5.6.40-1.w6.x86_64 1/18 Installing : php56w-pdo-5.6.40-1.w6.x86_64 2/18 Installing : php56w-cli-5.6.40-1.w6.x86_64 3/18 Installing : php56w-process-5.6.40-1.w6.x86_64 4/18 Installing : php56w-xml-5.6.40-1.w6.x86_64 5/18 Installing : libmcrypt-2.5.8-9.el6.x86_64 6/18 Installing : libc-client-2007e-11.el6.x86_64 7/18 Installing : t1lib-5.1.2-6.el6_2.1.x86_64 8/18 Installing : php56w-gd-5.6.40-1.w6.x86_64 9/18 Installing : php56w-imap-5.6.40-1.w6.x86_64 10/18 Installing : php56w-mcrypt-5.6.40-1.w6.x86_64 11/18 Installing : 1:php56w-pear-1.10.4-1.w6.noarch 12/18 Installing : php56w-5.6.40-1.w6.x86_64 13/18 Installing : php56w-mysql-5.6.40-1.w6.x86_64 14/18 Installing : php56w-odbc-5.6.40-1.w6.x86_64 15/18 Installing : php56w-xmlrpc-5.6.40-1.w6.x86_64 16/18 Installing : php56w-mbstring-5.6.40-1.w6.x86_64 17/18 Installing : php56w-ldap-5.6.40-1.w6.x86_64 18/18 Verifying : php56w-5.6.40-1.w6.x86_64 1/18 Verifying : php56w-imap-5.6.40-1.w6.x86_64 2/18 Verifying : php56w-xmlrpc-5.6.40-1.w6.x86_64 3/18 Verifying : t1lib-5.1.2-6.el6_2.1.x86_64 4/18 Verifying : php56w-mcrypt-5.6.40-1.w6.x86_64 5/18 Verifying : libc-client-2007e-11.el6.x86_64 6/18 Verifying : php56w-pdo-5.6.40-1.w6.x86_64 7/18 Verifying : php56w-process-5.6.40-1.w6.x86_64 8/18 Verifying : libmcrypt-2.5.8-9.el6.x86_64 9/18 Verifying : 1:php56w-pear-1.10.4-1.w6.noarch 10/18 Verifying : php56w-mysql-5.6.40-1.w6.x86_64 11/18 Verifying : php56w-xml-5.6.40-1.w6.x86_64 12/18 Verifying : php56w-odbc-5.6.40-1.w6.x86_64 13/18 Verifying : php56w-mbstring-5.6.40-1.w6.x86_64 14/18 Verifying : php56w-ldap-5.6.40-1.w6.x86_64 15/18 Verifying : php56w-gd-5.6.40-1.w6.x86_64 16/18 Verifying : php56w-common-5.6.40-1.w6.x86_64 17/18 Verifying : php56w-cli-5.6.40-1.w6.x86_64 18/18
Installed: php56w.x86_64 0:5.6.40-1.w6 php56w-gd.x86_64 0:5.6.40-1.w6 php56w-imap.x86_64 0:5.6.40-1.w6 php56w-ldap.x86_64 0:5.6.40-1.w6 php56w-mbstring.x86_64 0:5.6.40-1.w6 php56w-mcrypt.x86_64 0:5.6.40-1.w6 php56w-mysql.x86_64 0:5.6.40-1.w6 php56w-odbc.x86_64 0:5.6.40-1.w6 php56w-pdo.x86_64 0:5.6.40-1.w6 php56w-pear.noarch 1:1.10.4-1.w6 php56w-xml.x86_64 0:5.6.40-1.w6 php56w-xmlrpc.x86_64 0:5.6.40-1.w6
Dependency Installed: libc-client.x86_64 0:2007e-11.el6 libmcrypt.x86_64 0:2.5.8-9.el6 php56w-cli.x86_64 0:5.6.40-1.w6 php56w-common.x86_64 0:5.6.40-1.w6 php56w-process.x86_64 0:5.6.40-1.w6 t1lib.x86_64 0:5.1.2-6.el6_2.1
Complete!
注意:
1)「Complete!インストールが完了しました.
2)取付過程、一歩確認の段階があり、「y」を入力すればよい.
4.php-fpmのインストール
1)コマンド
yum install php56w-fpm

2)設置プロセス
[root@istester www]# yum install php56w-fpm
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php56w-fpm.x86_64 0:5.6.40-1.w6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================
Installing:
php56w-fpm x86_64 5.6.40-1.w6 webtatic 1.3 M

Transaction Summary

Install 1 Package(s)

Total download size: 1.3 M
Installed size: 3.9 M
Is this ok [y/N]: y
Downloading Packages:
php56w-fpm-5.6.40-1.w6.x86_64.rpm | 1.3 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php56w-fpm-5.6.40-1.w6.x86_64 1/1
Verifying : php56w-fpm-5.6.40-1.w6.x86_64 1/1

Installed:
php56w-fpm.x86_64 0:5.6.40-1.w6

Complete!


インストールされているPHPバージョンの表示
[root@istester www]# php -v PHP 5.6.40 (cli) (built: Jan 12 2019 09:19:57) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
5.サービスの開始
[root@istester www]# service php-fpm start Starting php-fpm: [ OK ]
6.サービス開始ステータスの表示
[root@istester www]# service php-fpm status php-fpm (pid 5139) is running...
7.インストールに成功したか確認する
1)ルートディレクトリ/var/www/htmlでファイルistesterを新規作成する.php
[root@istester html]# echo ""> istester.php
2)apacheサービスの再起動(表示-』apacheインストール配置ドキュメント)
service httpd restart
3)ブラウザアクセス
http://ip/istester.php
次のインタフェースが表示されたら、おめでとうございます.インストールに成功しました.
image
End
補足、
yumが持参したパッケージバージョンは、比較的低いです.多くの場合、システムのデフォルトインストールにはphpバージョン5.3がインストールされていますが、どのようにバージョンをアップグレードしますか?
記事を参照-』http://istester.com/article/161.html