8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MAMP環境をMac標準のもので作る(mysqlはインストールする)

Last updated at Posted at 2014-05-20

mysql

  • mysqlをインストール

PATH追加

  • PATH=/usr/local/mysql/bin:$PATH
/usr/local/mysql/my.cnf
+[client]
+default-character-set=utf8
+
+[mysqld]
+skip-character-set-client-handshake
+character-set-server = utf8
+collation-server = utf8_general_ci
+
+[mysqldump]
+default-character-set=utf8

apacheでphpを使えるようにする

/etc/apache2/httpd.conf
-#LoadModule php5_module libexec/apache2/libphp5.so
+LoadModule php5_module libexec/apache2/libphp5.so
-    DirectoryIndex index.html
+    DirectoryIndex index.html index.php
-    AllowOverride None
+    AllowOverride All
php.ini
$ sudo cp -p /etc/php.ini.default /etc/php.ini
$ sudo touch /var/log/apache2/php_errors.log
$ sudo chown _www:_www /var/log/apache2/php_errors.log
php.ini
-display_errors = Off
+display_errors = On

 [Date]
 ; Defines the default timezone used by the date functions
 ; http://php.net/date.timezone
 ;date.timezone =
+date.timezone = Asia/Tokyo

-;error_log = php_errors.log
+error_log = /var/log/apache2/php_errors.log

phpからmysqlに接続ができることを確認

/etc/php.ini
-pdo_mysql.default_socket=
+pdo_mysql.default_socket= "/tmp/mysql.sock"
-mysql.default_socket =
+mysql.default_socket = "/tmp/mysql.sock"
-mysqli.default_socket =
+mysqli.default_socket = "/tmp/mysql.sock"
<?php
if (!$conn = mysql_connect('localhost', 'root', '')) {
    die('MySQL接続失敗');
}
echo 'MySQL接続成功';
mysql_close($conn);

apache起動

起動
$ sudo /usr/sbin/apachectl restart

各種情報

ログ
$ tail -f /var/log/apache2/*log
DocumentRootを変更
$ sudo sed -ie "s@/Library/WebServer/Documents@/var/www@" /etc/apache2/httpd.conf
$ sudo mkdir /var/www
$ sudo chmod 777 /var/www
$ sudo /usr/sbin/apachectl restart
実行ユーザ
User _www
Group _www

safariのキャッシュクリア

  • alt+command+E
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?