Red Hat Enterprise Linux Server release 6.8にphp 5.4をインストールしたのでApacheから利用してみます。
- Install php54-php
- 設定ファイルの移動
- Apache起動
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 |
# yum info php54-php Loaded plugins: product-id, search-disabled-repos, security, subscription-manager Available Packages Name : php54-php Arch : x86_64 Version : 5.4.40 Release : 4.el6 Size : 1.3 M Repo : rhel-server-rhscl-6-rpms Summary : PHP scripting language for creating dynamic web sites URL : http://www.php.net/ License : PHP and Zend and BSD Description : PHP is an HTML-embedded scripting language. PHP attempts to make it : easy for developers to write dynamically generated web pages. PHP also : offers built-in database integration for several commercial and : non-commercial database management systems, so writing a : database-enabled webpage with PHP is fairly simple. The most common : use of PHP coding is probably as a replacement for CGI scripts. : : The php54-php package contains the module (often referred to as mod_php) : which adds support for the PHP language to system Apache HTTP Server. # yum install php54-php Loaded plugins: product-id, search-disabled-repos, security, subscription-manager Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php54-php.x86_64 0:5.4.40-4.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================= Package Arch Version Repository Size ========================================================================================================= Installing: php54-php x86_64 5.4.40-4.el6 rhel-server-rhscl-6-rpms 1.3 M Transaction Summary ========================================================================================================= Install 1 Package(s) Total download size: 1.3 M Installed size: 4.5 M Is this ok [y/N]: y Downloading Packages: php54-php-5.4.40-4.el6.x86_64.rpm | 1.3 MB 00:01 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : php54-php-5.4.40-4.el6.x86_64 1/1 Verifying : php54-php-5.4.40-4.el6.x86_64 1/1 Installed: php54-php.x86_64 0:5.4.40-4.el6 Complete! |
php54-phpのインストールでapache設定ファイル/etc/httpd/conf.d/php54-php.confが作成されます。
php 5.3の設定ファイル/etc/httpd/conf.d/php.confと競合するので移動してしまいます。
1 |
# mv /etc/httpd/conf.d/php.conf ~root/ |
1 2 |
# /etc/init.d/httpd start Starting httpd: [ OK ] |
それでは実際にphp 5.4が読み込まれているか確認してみます。
1 2 3 4 5 |
# vi /var/www/cgi-bin/phpinfo.php # cat /var/www/cgi-bin/phpinfo.php <?php phpinfo(); ?> |
http://apache_ip_address/cgi-bin/phpinfo.php
読み込む設定ファイルの場所が異なるので注意が必要です。
Loaded Configuration File /opt/rh/php54/root/etc/php.ini
Scan this dir for additional .ini files /opt/rh/php54/root/etc/php.d