Ubuntu 16.04

PHP 5.6

1
2
3
4
5
6
7
8
9
10
11
1、添加PPA
$ sudo apt-get install python-software-properties software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
2、安装PHP5.6以及所需的一些扩展
$ sudo apt-get install php5.6-fpm php5.6-mysql php5.6-common php5.6-curl php5.6-cli php5.6-mcrypt php5.6-mbstring php5.6-dom
3、配置PHP5.6
打开php.ini配置文件:
$ sudo vim /etc/php/5.6/fpm/php.ini
找到cgi.fix_pathinfo选项,去掉注释;,然后将值设置为0:
cgi.fix_pathinfo = 0

Nginx

1
2
3
4
$sudo apt-get update
$sudo apt-get install nginx
$sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old
$sudo vim /etc/nginx/sites-available/default

default 文件内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
server {
        listen       80;
        server_name  your_site_name.com;
        root /var/www/html;
        index index.php index.html;

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

一定记住重启

1
$sudo service nginx restart

建立测试文件info.php

1
$sudo vim /var/www/html/info.php
1
2
3
<?php
    phpinfo();
?>

测试好以后,记得删除

1
$sudo rm /var/www/html/info.php

MySQL

1
2
3
4
5
6
7
8
安装服务器端
$sudo apt-get install mysql-server
安装客户端
$sudo apt-get install mysql-client
root的密码也是root,默认安装在/usr
启动mysql
$sudo service mysql start
$sudo mysql -uroot -p

PhpStrom

1
2
3
4
5
wget https://download-cf.jetbrains.com/webide/PhpStorm-2016.1.2.tar.gz
tar xvf PhpStorm-2016.1.2.tar.gz
sudo mv PhpStorm-145.1616.3/ /opt/phpstorm/
sudo ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm
phpstorm

license

1
http://www.0-php.com:1017