サーバ作成引継ぎ 続き 〜PHPとMySQL〜

今回の環境は自分ひとりでほよほよ使えればよいものではないので、バーチャルドメインの設定が必要です。
・・・なんとなく理解はしてますが、自信がないのであとまわし(ぉい)

サーバが動いたところで、PHPMySQLの確認。

php -v
PHP 5.1.6 (cli) (built: Jan 21 2009 01:40:08)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

5.2にはしなくてよい、ということなので yumでupdateだけしておきました。

yum update php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* updates: www.ftp.ne.jp
* addons: www.ftp.ne.jp
* extras: www.ftp.ne.jp
Setting up Update Process
Resolving Dependencies

    • > Running transaction check
      • > Package php.i386 0:5.1.6-23.2.el5_3 set to be updated
    • > Processing Dependency: php-cli = 5.1.6-23.2.el5_3 for package: php
    • > Processing Dependency: php-common = 5.1.6-23.2.el5_3 for package: php
    • > Running transaction check
      • > Package php-cli.i386 0:5.1.6-23.2.el5_3 set to be updated
      • > Package php-common.i386 0:5.1.6-23.2.el5_3 set to be updated
    • > Processing Dependency: php-common = 5.1.6-23.el5 for package: php-ldap
    • > Running transaction check
      • > Package php-ldap.i386 0:5.1.6-23.2.el5_3 set to be updated
    • > Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================
Updating:
php i386 5.1.6-23.2.el5_3 updates 1.1 M
php-cli i386 5.1.6-23.2.el5_3 updates 2.1 M
php-common i386 5.1.6-23.2.el5_3 updates 151 k
php-ldap i386 5.1.6-23.2.el5_3 updates 36 k

(中略)
Updated: php.i386 0:5.1.6-23.2.el5_3 php-cli.i386 0:5.1.6-23.2.el5_3 php-common.i386 0:5.1.6-23.2.el5_3 php-ldap.i386 0:5.1.6-23.2.el5_3
Complete!

お約束のphpinfo(); で状態確認。
PHP拡張モジュールなどはほとんどはいってないので、現状わかってる範囲で必要なもの追加。

yum install php-mbstring
yum install php-mbstring

と、ここまでやったところでSTOPが。
「サービス入れるときに、めいめいで必要なモジュール確認させて、いれる手順にして」
 ということで、予測導入はやめました。
↑は入れてしまいましたが ^^; まあ、設定はしてないのでご勘弁 ^^;

MySQL。メモに一切記載が無いので、まずはインストール状況確認。

yum list | grep 'mysql'
mysql.i386 5.0.45-7.el5 installed
(中略)
php-mysql.i386 5.1.6-23.2.el5_3 update

入ってはいますが

mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

のーーん ^^;

ps ax | grep mysqld
30146 pts/1 S+ 0:00 grep mysqld

起動はしてるっぽい。
vi /etc/my.cnfで設定確認。ネットで調べると、

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

この辺りの問題らしい。
http://www.hi-ho.ne.jp/tsumiki/book_sup2.html

・・・・って!
/var/lib/mysql ないじゃんっ!!!
なにこれぇぇぇ(゚ロ゚;)

http://centossrv.com/mysql.shtml
・・・・・納得。
mysql-serverを入れるのですね。御意。

たしかに

mysql-server.i386 5.0.45-7.el5 base

ですわ・・・・

yum install mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* updates: www.ftp.ne.jp
* addons: www.ftp.ne.jp
* extras: www.ftp.ne.jp
Setting up Install Process
Parsing package install arguments
Resolving Dependencies

    • > Running transaction check
      • > Package mysql-server.i386 0:5.0.45-7.el5 set to be updated
    • > Processing Dependency: perl-DBD-MySQL for package: mysql-server
    • > Running transaction check
    • > Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================
Installing:
mysql-server i386 5.0.45-7.el5 base 9.7 M
Installing for dependencies:
perl-DBD-MySQL i386 3.0007-2.el5 base 148 k

Transaction Summary
==========================================================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
(中略)
Installed: mysql-server.i386 0:5.0.45-7.el5
Dependency Installed: perl-DBD-MySQL.i386 0:3.0007-2.el5

/etc/my.cnf確認。変わったようには見えませんが ^^;
でも、/var/lib/mysql/が作成されました。

/etc/rc.d/init.d/mysqld start
MySQL データベースを初期化中: Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h starbacks.mmsoft.co.jp password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[ OK ]
MySQL を起動中: [ OK ]

mysql -v
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45 Source distribution

Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

よしよし ^^

ではこれも、自動起動設定。

chkconfig mysqld on
chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

MySQLいっちょあーがり♪