หลังจากอัพเกรด Mac OS X ไปเป็น Tiger 10.4 แล้ว wiki ก็ไม่เวิร์ค วันนี้จะ troubleshoot แล้วก็เลย
ถือโอกาส อัพเกรดไปพร้อมๆกันเลย
รายละเอียดเริ่มอ้างอิงจากที่นี่
http://meta.wikimedia.org/wiki/Running_MediaWiki_on_Mac_OS_X==== Apache 2 ====download Apache 2 จาก
http://www.serverlogistics.com/downloads.phpFiles ต่างๆของ Apache 2 ถูกติดตั้งลงไปยัง /Library/Apache2 ไม่ทับ Apache ที่ติดมากับ OS
แต่ดั้งเดิม. นอกจาก start กับ stop แล้ว ยังมี graceful ที่ใช้เป็น parameter สำหรับ apachectl ได้
# /Library/Apache2/bin/apachectl {start,stop,graceful}
ลง preference pane เพิ่ม ได้ที่ /Library/PreferencePanes หรือ $HOME/Library/PreferencePanes เวลาจะ uninstall ก็อย่าลืมเอาออกด้วย
Preference pane ของ Apache 2 ที่ติดตั้งลงไปมันจะทำการเซตค่า APACHE2 ใน /etc/hostconfig
เพื่อกำหนดว่าจะให้ Apache 2 start ตอน boot หรือไม่
จะ uninstall ก็ลบไดเรคทอรี่เหล่านี้ออกซะ (อ้างอิง Install Guide ใน dmg installer file)
/Library/Apache2
/Library/StartupItems/Apache2
/Library/Receipts/Apache2.pkg
==== MySQL ====
MySQL เดี้ยงต้องจัดการก่อน เพราะเคยลง CompleteMySQL 4.0.21 ของ serverlogistics ไว้ แต่มันใช้กับ Tiger ไม่ได้?? หรือได้หว่า??
การลบ CompleteMySQL (อ้างอิงจาก Install Guide ที่อยู่ใน dmg installer file) ออกทำโดย:
- Backup databases ที่มีอยู่ทั้งหมดก่อน
- ลบ directory เหล่านี้
- /Library/MySQL
- /Library/StartupItems/MySQL
- /Library/Receipts/MySQL.pkg
- หากต้องการ/จำเป็น ลบ mysql user ออกจากระบบด้วยก็
# sudo niutil -destroy . /users/mysql
- ลบ MySQL.prefPane ออกจาก /Library/PreferencePanes หรือ $HOME/Library/PreferencePanes
การติดตั้ง MySQL 5
(ดูเพิ่มเติม http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-4-1.html)- download mysql-standard-5.0.18-osx10.4-powerpc-64bit.dmg จาก
http://dev.mysql.com/downloads/mysql/5.0.html- MySQL จะ install ไปที่ /usr/local/mysql-VERSION และทำ symbolic link ชี้มาจาก /usr/local/mysql
- หลัง install แล้วต้องทำ
- Install MySQLStartupItem.pkg ถ้าต้องการให้ MySQL start up automatically ตอน system
startup Startup Item for MySQL 5.0 is installed into
`/Library/StartupItems/MySQLCOM'. (Before MySQL 4.1.2, the location was
`/Library/StartupItems/MySQL)
- secure the default accounts หลังจากติดตั้ง MySQL เสร็จใหม่ๆ installer ของ Mac มันจะ initialize database ให้อยู่แล้ว (mysql_install_db) แต่ grant tables ที่มัน init มาให้จะไม่มี password ดังนั้นเราต้องเซต password ด้วยเพื่อความปลอดภัย
ปล. มี CocoaMySQL ที่เคยลงไว้ มันเป็น client เอาไว้ connect ไปจัดการกับ MySQL server แต่ CocoaMySQL ใช้กับ version 4.0.21 ได้ แต่ไม่สามารถใช้กับ version 5 ได้เพราะว่า password
encryption มันต่างกัน ต้องไปใช้ CocoaMySQL version beta0.7 ถึงเวิร์ค
- copy database ที่ dump ออกมาจากตัวเก่าไปยัง version ใหม่
(อ้างอิง:
http://dev.mysql.com/doc/refman/5.0/en/upgrading-to-arch.html?ff=nopfpls)
หลังจาก upgrade จาก Panther ไปเป็น 10.4 Tiger แล้ว PHP communication with MySQL server มีปัญหาเพราะ socket ถูกย้ายด้วยเหตุผลทางด้าน security
(อ้างอิง: http://docs.info.apple.com/article.html?artnum=301457, http://docs.info.apple.com/article.html?artnum=302977)Mac OS X Server 10.4: Issues connecting PHP to MySQL (ลองดูใน script mysqld_safe ดูได้ว่ามันเรียกไปยัง /tmp/mysql.sock) When running MySQL and PHP on the same Mac OS X 10.4 server, you may find that PHP cannot connect to MySQL. When PHP is communicating with a MySQL server on the same host, it uses a socket file to communicate, and looks for it at /tmp/mysql.sock. On Mac OS X Server 10.4, MySQL creates this socket file at /var/mysql/mysql.sock.
To resolve this issue, you can either change the location where MySQL creates its socket file, or modify the location where PHP looks for the file. Please note that the first option is less secure than the second. Before delving in, you should also review new information relevant to PHP and MySQL on Mac OS X Server 10.4.4 and later.
To change the location where MySQL creates its socket file, do this:
- Open your preferred text editor and create a plain text file.
- Type this text (on two lines as shown):
[mysqld]
socket=/tmp/mysql.sock
- Save the file as: /etc/my.cnf
To change the location where PHP looks for the socket file, follow these steps:
- In Terminal: sudo cp /etc/php.ini.default /etc/php.ini
- Open /etc/php.ini in your preferred text editor.
- Find the [MySQL] section, and change the mysql.default_socket directive:
; Default socket name for local MySQL connects. If empty, uses
the built-in
; MySQL defaults.
mysql.default_socket = /var/mysql/mysql.sock
- Change the permissions on /var/mysql so that www can read the socket, by executing this in Terminal:
sudo chmod 775 /var/mysql
การย้าย database
http://meta.wikimedia.org/wiki/How_to_move_a_MediaWiki_Database
An example command on how to dump the database on a Debian GNU/Linux machine using mysqldump:
mysqldump --user=USERNAME --password=PASSWORD --single-transaction --all-databases > BACKUPFILE.sql
dump database named "wikidb"
mysqldump -u root -B wikidb > wikidb.sql
restore database named "wikidb"
mysql -u root -B wikidb <>
Create user ใหม่ขึ้นมาบน MySQL database อันใหม่ที่เรา import เข้ามาแล้ว โดยใช้คำสั่ง GRANT
คำสั่ง GRANT จะ encrypt password ให้ดังนั้นไม่จำเป็นต้องเรียกใช้ PASSWORD('password')
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON wikidb.*
-> TO 'wikiuser'@'localhost'
-> IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.05 sec)
bossanova:~/tmp/php-5.1.2 jojo$ ./configure '--prefix=/usr/local/php5.1.2' '--with-apxs2=/Library/Apache2/bin/apxs' '--with-ldap' '--with-kerberos' '--enable-cli' '--with-zlib' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-sockets' '--with-iodbc' '--with-cure' '--with-config-file-path=/usr/local/php5.1.2/etc' '--with-mysql=/usr/local/mysql' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-mysql-sock=/var/mysql/mysql.sock'
Compile Turck MMCache with your PHP
download ที่นี่ --> http://turck-mmcache.sourceforge.net/
วิธีการ compile ที่นี่ --> http://www.phpmac.com/articles.php?view=166shell> /usr/bin/phpize
shell> ./configure --enable-mmcache=shared --with-php-config=/usr/bin/php-config
shell> make
shell> sudo make install
add below to the bottom of your php.ini (
/usr/local/lib/php.ini <--ผิด ที่ถูกคือ
/etc/php.ini แต่มันยังมี
/private/etc/php.ini ด้วย อันหลังนี้คิดว่าคงไม่ได้ใช้)
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20020429/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
รัน install จาก web เพราะลองรัน php จาก cli ดูแล้วมันไม่เวิร์ค
กรอกข้อมูลให้ถูกต้องเหมือนของเก่า แล้วก็ไปแก้ไฟล์ LocalSettings.php ที่ installer มัน generate
มาให้ โดยอ้างอิงจาก LocalSettings.php ของเก่า แก้ไปรีเฟรช browserใหม่ไปดู เท่านี้ก็เรียบร้อย