Skip to content

Development Environment

LoLo edited this page Mar 17, 2017 · 5 revisions

#Development Environment

This page is mostly for development environment setup. You are supposed to config LAMP/MAMP environment successfully, if not, please ask Google or someone else for help. And you are also supposed to use Mac OS X, if not, the path may be a little different.

Apache configuration

Create a new configuration file capurace.conf with following content under /etc/apache2/other/. Remember to replace <path/to/capurace> with the path to your local capurace codebase. e.g. For me, it's /Users/huxuan/Code/capurace.

<VirtualHost *:80>
  ServerName capurace
  DocumentRoot [path/to/capurace]
  <Directory [path/to/capurace]>
    Require all granted
  </Directory>
</VirtualHost>

Custom Host

Add the following line at the end of /etc/hosts.

127.0.0.1	capurace

Configuring PHP5 with MySQL support on MacOS - /etc/php.ini

If you are using MacOS, you may need to do the following steps.

In /etc there is a /etc/php.ini file. If not, run the following command at first:

sudo cp /etc/php.ini.default /etc/php.ini

Open /etc/php.ini and look for mysql.default_socket.

sudo vi /etc/php.ini

The default of mysql.default_socket is /var/mysql/mysql.sock. You should change it to the correct socket path - it was /tmp/mysql.sock in my case. To get the path, logging in MySQL and run:

show variables like '%socket%';

Find mysql.default_socket and mysqli.default_socket and change its value:

mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock

Finally restart Apache

sudo apachectl restart