mac の開発環境構築 〜php5-mysql〜

方針

PHPから使えるようにphp5-mysqlをインストールします。

php5-mysqlインストール

$ sudo port install php5-mysql
・・・
###########################################################
# A startup item has been generated that will aid in
# starting apache2 with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load apache2
###########################################################
Note: apache2 installs files outside the common directory structure.
・・・

apache2をloadしてくださいとのこと。

apache2をload

言われるままに、apache2をloadしてみます。

$ sudo port load apache2
Password:
Error: Target org.macports.load returned: org.macports.apache2: Already loaded
Log for apache2 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_apache2/main.log
Error: Status 1 encountered during processing.
To report a bug, see 

またまたエラー。もう入ってます。ですって。

php.iniの設定

php.iniのdefault_socketを設定します。

$ sudo vi /opt/local/etc/php5/php.ini

pdo_mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock
mysql.default_socket =/opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket =/opt/local/var/run/mysql5/mysqld.sock

apacheを再起動してphpinfoで確認。OK!

参考サイト:macportsでMac Snow LeopardにApache2 + PHP5 + MySQL5 を入れる

インストールログ

$ sudo port install php5-mysql

--->  Computing dependencies for openssl
--->  Fetching openssl
--->  Verifying checksum(s) for openssl
--->  Extracting openssl
--->  Applying patches to openssl
--->  Configuring openssl
--->  Building openssl
--->  Staging openssl into destroot
--->  Computing dependencies for openssl
--->  Installing openssl @1.0.0a_1
--->  Deactivating openssl @1.0.0a_0
--->  Cleaning openssl
--->  Activating openssl @1.0.0a_1
--->  Cleaning openssl
--->  Computing dependencies for apache2
--->  Fetching apache2
--->  Attempting to fetch httpd-2.2.17.tar.bz2 from ftp://ftp.infoscience.co.jp/pub/net/apache/dist/httpd
--->  Attempting to fetch httpd-2.2.17.tar.bz2 from http://distfiles.macports.org/apache2
--->  Verifying checksum(s) for apache2
--->  Extracting apache2
--->  Applying patches to apache2
--->  Configuring apache2
--->  Building apache2
--->  Staging apache2 into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting apache2 with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load apache2
###########################################################
Note: apache2 installs files outside the common directory structure.
--->  Computing dependencies for apache2
--->  Installing apache2 @2.2.17_0+preforkmpm
--->  Deactivating apache2 @2.2.16_0+preforkmpm
--->  Cleaning apache2
--->  Activating apache2 @2.2.17_0+preforkmpm
--->  Cleaning apache2
--->  Computing dependencies for php5-mysql
--->  Cleaning php5-mysql

投稿日:

ページのトップへ戻る