ubuntu 16.04 php 开发环境搭建
mysql
sudo apt install -y mysql-server mysql-client
php 5.6
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt install -y php5.6 php5.6-fpm php5.6-mysql php5.6-mbstring php5.6-curl php5.6-xml
nginx
sudo apt install -y nginx
sudo vim /etc/nginx/sites-enabled/default
# root /var/www/html;
root /project/path;
...
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
}
sudo systemctl reload nginx
phpstorm
sudo apt install -y php-xdebug
sudo vim /etc/php/5.6/mods-available/xdebug.ini
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=PHPSTROM
sudo systemctl restart php5.6-fpm
Go to http://www.jetbrains.com/phpstorm/marklets/
Click the Generate button under the Xdebug section, then drag the links “Start debugger” and “Stop debugger” from the Debug section that appears to the Bookmarks Toolbar.
参考资料:
https://askubuntu.com/questions/756181/installing-php-5-6-on-xenial-16-04
https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm