Skip to content

Instantly share code, notes, and snippets.

@JasonQSY
Last active December 22, 2016 13:54
Show Gist options
  • Save JasonQSY/2b5bd84fb36496159ee2c94030c04987 to your computer and use it in GitHub Desktop.
Save JasonQSY/2b5bd84fb36496159ee2c94030c04987 to your computer and use it in GitHub Desktop.

On mac, make sure you have homebrew.

brew --version

Install php (use php56 instead of php71 if you want PHP 5.6 instead of PHP 7.1.)

brew tap homebrew/php
brew install php71
brew services start php71

For command line interface, we need add /usr/local/sbin/php-fpm into $PATH.

vim ~/.zshrc # or ~/.bash_profile, depend on the shell

and add

export PATH = /usr/local/sbin:$PATH

For tongqu, we need install php-redis.

brew install php-redis
brew services restart php71

Install nginx

brew install nginx
brew services start nginx

Install MySQL

brew install mysql
mysql_secure_installation # change password
brew services start mysql

If mysql works well

mysql -u root -p # enter the password

Login into mysql,

create database tongqu;
use tongqu;
source tongqu.sql; # note the directory

Install redis

brew install redis
brew services start redis

Now the installation is ok. We move the conf file to nginx to start the local server.

git clone https://url/to/tongqu4.git && cd tonqgu4
cp doc/conf/tonqgu.conf /usr/local/etc/nginx/servers
cd /usr/local/etc/nginx/servers
vim tongqu.conf

We need change serveral things.

listen 8084 # any port you like
root /path/to/tongqu4 # the path

fastcgi_pass 127.0.0.1:9000

Note that it is completely ok to use unix socket. However, the php-fpm installed by homerbrew use 127.0.0.1:9000 by default. Now we can

nginx -s reload # restart to server to take effect

The environment is ok now and we need configure the tonqgu.

cd /path/to/tongqu4
sh concat.sh
php gen_constant.php

and change your username and password in dev/application/config/database.php.

Now have a look at localhost:8084. Check the proxy setting there is no response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment