Skip to content

Install PHP environment for Mac

Vu Van Ly edited this page Jun 19, 2015 · 15 revisions

##Setup virtual host http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-10-yosemite/ ##Import database

mysql -uroot
create database balinese;
use balinese;
source ~/Downloads/balinese.sql

##Config access mode: Inside source folder, run command:

sudo chmod -R 777 data/ hiddendata/ logs/ tmp/

In file /etc/apache2/httpd.conf, uncomment these below lines:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

##Fix error: Forbidden access: In file /etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin vanly.se05@gmail.com
    DocumentRoot "/Library/WebServer/Documents/rakujuku/for_broardcast_20150319/src/htdocs"
    ServerName RakuJuku
    ServerAlias rakujuku.com
    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
    <Directory "/Library/WebServer/Documents/rakujuku/for_broardcast_20150319/src/htdocs">
        Allow from all
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Update ehost

sudo nano /etc/hosts

add add

127.0.0.1 domain.com

Install PHP 5.3

brew install homebrew/php/php53

Check version

httpd -v
php -v 
mysql -v

Apache command

sudo apachectl start
sudo apachectl restart
sudo apachectl stop

MySQL command

mysql.server start   #start server mysql
mysql -uroot      # connect mysql

Fix error cannot connect to MySQL

change host from localhost to 127.0.0.1

TIPS when import big database.

Remove foreign key checking.

Try DISABLE KEYS or

SET FOREIGN_KEY_CHECKS=0;

make sure to

SET FOREIGN_KEY_CHECKS=1;

after.

Clone this wiki locally