PHP + HTTPD:Install by YUM
YUM安装软件包:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
[root@zabbix ~]# yum install httpd php mysql mysql-server php-mysql Loaded plugins: fastestmirror, refresh-packagekit, security base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:16 extras | 3.4 kB 00:00 extras/primary_db | 37 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 1.4 MB 00:03 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.2.15-29.el6.centos will be updated ---> Package httpd.x86_64 0:2.2.15-54.el6.centos will be an update --> Processing Dependency: httpd-tools = 2.2.15-54.el6.centos for package: httpd-2.2.15-54.el6.centos.x86_64 ---> Package mysql.x86_64 0:5.1.73-7.el6 will be installed --> Processing Dependency: mysql-libs = 5.1.73-7.el6 for package: mysql-5.1.73-7.el6.x86_64 ---> Package mysql-server.x86_64 0:5.1.73-7.el6 will be installed --> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-7.el6.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-7.el6.x86_64 --> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-7.el6.x86_64 ---> 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-mysql.x86_64 0:5.3.3-48.el6_8 will be installed --> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-48.el6_8.x86_64 --> Running transaction check ---> Package httpd-tools.x86_64 0:2.2.15-29.el6.centos will be updated ---> Package httpd-tools.x86_64 0:2.2.15-54.el6.centos will be an update ---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be updated ---> Package mysql-libs.x86_64 0:5.1.73-7.el6 will be an update ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed ---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed ---> 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 ---> Package php-pdo.x86_64 0:5.3.3-48.el6_8 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================== Installing: mysql x86_64 5.1.73-7.el6 base 894 k mysql-server x86_64 5.1.73-7.el6 base 8.6 M php x86_64 5.3.3-48.el6_8 updates 1.1 M php-mysql x86_64 5.3.3-48.el6_8 updates 86 k Updating: httpd x86_64 2.2.15-54.el6.centos updates 833 k Installing for dependencies: perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k perl-DBI x86_64 1.609-4.el6 base 705 k php-cli x86_64 5.3.3-48.el6_8 updates 2.2 M php-common x86_64 5.3.3-48.el6_8 updates 530 k php-pdo x86_64 5.3.3-48.el6_8 updates 80 k Updating for dependencies: httpd-tools x86_64 2.2.15-54.el6.centos updates 79 k mysql-libs x86_64 5.1.73-7.el6 base 1.2 M Transaction Summary ===================================================================================================================================== Install 9 Package(s) Upgrade 3 Package(s) Total download size: 16 M Is this ok [y/N]: y Downloading Packages: (1/12): httpd-2.2.15-54.el6.centos.x86_64.rpm | 833 kB 00:01 (2/12): httpd-tools-2.2.15-54.el6.centos.x86_64.rpm | 79 kB 00:00 (3/12): mysql-5.1.73-7.el6.x86_64.rpm | 894 kB 00:01 (4/12): mysql-libs-5.1.73-7.el6.x86_64.rpm | 1.2 MB 00:02 (5/12): mysql-server-5.1.73-7.el6.x86_64.rpm | 8.6 MB 00:19 (6/12): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00 (7/12): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:01 (8/12): php-5.3.3-48.el6_8.x86_64.rpm | 1.1 MB 00:02 (9/12): php-cli-5.3.3-48.el6_8.x86_64.rpm | 2.2 MB 00:04 (10/12): php-common-5.3.3-48.el6_8.x86_64.rpm | 530 kB 00:01 (11/12): php-mysql-5.3.3-48.el6_8.x86_64.rpm | 86 kB 00:00 (12/12): php-pdo-5.3.3-48.el6_8.x86_64.rpm | 80 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------- Total 438 kB/s | 16 MB 00:38 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Importing GPG key 0xC105B9DE: Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org> Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : php-common-5.3.3-48.el6_8.x86_64 1/15 Updating : mysql-libs-5.1.73-7.el6.x86_64 2/15 Installing : perl-DBI-1.609-4.el6.x86_64 3/15 Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 4/15 Installing : mysql-5.1.73-7.el6.x86_64 5/15 Installing : php-cli-5.3.3-48.el6_8.x86_64 6/15 Installing : php-pdo-5.3.3-48.el6_8.x86_64 7/15 Updating : httpd-tools-2.2.15-54.el6.centos.x86_64 8/15 Updating : httpd-2.2.15-54.el6.centos.x86_64 9/15 Installing : php-5.3.3-48.el6_8.x86_64 10/15 Installing : php-mysql-5.3.3-48.el6_8.x86_64 11/15 Installing : mysql-server-5.1.73-7.el6.x86_64 12/15 Cleanup : httpd-2.2.15-29.el6.centos.x86_64 13/15 Cleanup : httpd-tools-2.2.15-29.el6.centos.x86_64 14/15 Cleanup : mysql-libs-5.1.71-1.el6.x86_64 15/15 Verifying : mysql-libs-5.1.73-7.el6.x86_64 1/15 Verifying : php-5.3.3-48.el6_8.x86_64 2/15 Verifying : mysql-5.1.73-7.el6.x86_64 3/15 Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 4/15 Verifying : php-cli-5.3.3-48.el6_8.x86_64 5/15 Verifying : php-pdo-5.3.3-48.el6_8.x86_64 6/15 Verifying : mysql-server-5.1.73-7.el6.x86_64 7/15 Verifying : httpd-tools-2.2.15-54.el6.centos.x86_64 8/15 Verifying : php-mysql-5.3.3-48.el6_8.x86_64 9/15 Verifying : perl-DBI-1.609-4.el6.x86_64 10/15 Verifying : httpd-2.2.15-54.el6.centos.x86_64 11/15 Verifying : php-common-5.3.3-48.el6_8.x86_64 12/15 Verifying : httpd-2.2.15-29.el6.centos.x86_64 13/15 Verifying : httpd-tools-2.2.15-29.el6.centos.x86_64 14/15 Verifying : mysql-libs-5.1.71-1.el6.x86_64 15/15 Installed: mysql.x86_64 0:5.1.73-7.el6 mysql-server.x86_64 0:5.1.73-7.el6 php.x86_64 0:5.3.3-48.el6_8 php-mysql.x86_64 0:5.3.3-48.el6_8 Dependency Installed: perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6 php-cli.x86_64 0:5.3.3-48.el6_8 php-common.x86_64 0:5.3.3-48.el6_8 php-pdo.x86_64 0:5.3.3-48.el6_8 Updated: httpd.x86_64 0:2.2.15-54.el6.centos Dependency Updated: httpd-tools.x86_64 0:2.2.15-54.el6.centos mysql-libs.x86_64 0:5.1.73-7.el6 Complete! [root@zabbix ~]# |
启动服务:
1 2 3 4 |
[root@zabbix ~]# service httpd start Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.232.188 for ServerName [ OK ] [root@zabbix ~]# |
创建样例文件:
1 2 3 4 5 6 7 8 9 10 11 |
[root@zabbix ~]# cd /var/www/html/ [root@zabbix html]# ls [root@zabbix html]# [root@zabbix html]# echo "<?php phpinfo(); ?>" > me.php [root@zabbix html]# [root@zabbix html]# ls me.php [root@zabbix html]# [root@zabbix html]# cat me.php <?php phpinfo(); ?> [root@zabbix html]# |
浏览器访问:
http://192.168.232.188/
http://192.168.232.188/me.php
可以看到,PHP运行成功。
————————————————————
Done。