Subscribe:

2010/10/02

phpインストール(さくらVPSサーバー)





インストール


[root@centos]# yum -y install php ( -y:確認メッセージ省略 )
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: rsync.atworks.co.jp
* base: rsync.atworks.co.jp
* extras: rsync.atworks.co.jp
* updates: rsync.atworks.co.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.1.6-27.el5 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php
--> Processing Dependency: php-cli = 5.1.6-27.el5 for package: php
--> Running transaction check
---> Package php-cli.x86_64 0:5.1.6-27.el5 set to be updated
---> Package php-common.x86_64 0:5.1.6-27.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
php x86_64 5.1.6-27.el5 base 2.3 M
Installing for dependencies:
php-cli x86_64 5.1.6-27.el5 base 2.2 M
php-common x86_64 5.1.6-27.el5 base 153 k
Transaction Summary
==========================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)
Total download size: 4.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): php-common-5.1.6-27.el5.x86_64.rpm | 153 kB 00:00
(2/3): php-cli-5.1.6-27.el5.x86_64.rpm | 2.2 MB 00:00
(3/3): php-5.1.6-27.el5.x86_64.rpm | 2.3 MB 00:00
------------------------------------------------------------------------------------------
Total 6.8 MB/s | 4.7 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-common 1/3
Installing : php-cli 2/3
Installing : php 3/3
Installed:
php.x86_64 0:5.1.6-27.el5
Dependency Installed:
php-cli.x86_64 0:5.1.6-27.el5 php-common.x86_64 0:5.1.6-27.el5
Complete!
[root@centos]# yum -y install php-mbstring php-mysql php-mcrypt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: rsync.atworks.co.jp
* base: rsync.atworks.co.jp
* extras: rsync.atworks.co.jp
* updates: rsync.atworks.co.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mbstring.x86_64 0:5.1.6-27.el5 set to be updated
---> Package php-mcrypt.x86_64 0:5.1.6-15.el5.centos.1 set to be updated
--> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt
---> Package php-mysql.x86_64 0:5.1.6-27.el5 set to be updated
--> Processing Dependency: php-pdo for package: php-mysql
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: php-mysql
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: php-mysql
--> Running transaction check
---> Package libmcrypt.x86_64 0:2.5.8-4.el5.centos set to be updated
---> Package mysql.x86_64 0:5.0.77-4.el5_5.3 set to be updated
--> Processing Dependency: perl(DBI) for package: mysql
---> Package php-pdo.x86_64 0:5.1.6-27.el5 set to be updated
--> Running transaction check
---> Package perl-DBI.x86_64 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
php-mbstring x86_64 5.1.6-27.el5 base 1.0 M
php-mcrypt x86_64 5.1.6-15.el5.centos.1 extras 16 k
php-mysql x86_64 5.1.6-27.el5 base 89 k
Installing for dependencies:
libmcrypt x86_64 2.5.8-4.el5.centos extras 105 k
mysql x86_64 5.0.77-4.el5_5.3 updates 4.8 M
perl-DBI x86_64 1.52-2.el5 base 600 k
php-pdo x86_64 5.1.6-27.el5 base 66 k
Transaction Summary
==========================================================================================
Install 7 Package(s)
Upgrade 0 Package(s)
Total download size: 6.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): php-mcrypt-5.1.6-15.el5.centos.1.x86_64.rpm | 16 kB 00:00
(2/7): php-pdo-5.1.6-27.el5.x86_64.rpm | 66 kB 00:00
(3/7): php-mysql-5.1.6-27.el5.x86_64.rpm | 89 kB 00:00
(4/7): libmcrypt-2.5.8-4.el5.centos.x86_64.rpm | 105 kB 00:00
(5/7): perl-DBI-1.52-2.el5.x86_64.rpm | 600 kB 00:00
(6/7): php-mbstring-5.1.6-27.el5.x86_64.rpm | 1.0 MB 00:00
(7/7): mysql-5.0.77-4.el5_5.3.x86_64.rpm | 4.8 MB 00:00
------------------------------------------------------------------------------------------
Total 6.5 MB/s | 6.6 MB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-pdo 1/7
Installing : perl-DBI 2/7
Installing : mysql 3/7
Installing : libmcrypt 4/7
Installing : php-mysql 6/7
Installing : php-mcrypt 7/7
Installed:
php-mbstring.x86_64 0:5.1.6-27.el5 php-mcrypt.x86_64 0:5.1.6-15.el5.centos.1
php-mysql.x86_64 0:5.1.6-27.el5
Dependency Installed:
libmcrypt.x86_64 0:2.5.8-4.el5.centos mysql.x86_64 0:5.0.77-4.el5_5.3
perl-DBI.x86_64 0:1.52-2.el5 php-pdo.x86_64 0:5.1.6-27.el5
Complete!
[root@centos]#

php.ini 設定


設定ファイルのバックアップ
[root@centos]# cp /etc/php.ini /etc/php.ini.default
[root@centos]# vi /etc/php.ini
348行目 ;error_reporting = E_ALL & ~E_NOTICE コメントを削除
360行目 error_reporting = E_ALL → ;error_reporting = E_ALL
367行目 display_errors = Off → On 本番環境では非推奨
639行目 date.timezone = → date.timezone ="Asia/Tokyo"
1130行目 ;mbstring.internal_encoding = EUC-JP → mbstring.internal_encoding = UTF8
:wq 上書き保存して終了
[root@centos]# /etc/init.d/httpd restart php.ini適用の為、httpd再起動
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@centos]#

php動作テスト


[root@centos]# vi /var/www/html/phpinfo.php
<?php phpinfo(); ?>
:wq 上書き保存して終了
[root@centos]# chmod 755 /var/www/html/phpinfo.php 実行権限付与
ブラウザから http://自分のアドレス/phpinfo.php にアクセス
phpバージョン等が表示されれば成功

2 件のコメント:

Tweets that mention phpインストール(さくらVPSサーバー) -- Topsy.com さんのコメント...

[...] This post was mentioned on Twitter by マスター, わかめにゅーす(PHP). わかめにゅーす(PHP) said: phpインストール(さくらVPSサーバー) http://bit.ly/9P15om [...]

さくらVPSを借りてから参考にしたサイト « tech* さんのコメント...

[...] phpインストール – [...]