惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
L
LINUX DO - 最新话题
Help Net Security
Help Net Security
N
News | PayPal Newsroom
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Last Watchdog
The Last Watchdog
S
Security @ Cisco Blogs
W
WeLiveSecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
N
News and Events Feed by Topic
T
Threat Research - Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tor Project blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Darknet – Hacking Tools, Hacker News & Cyber Security
PCI Perspectives
PCI Perspectives
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
S
SegmentFault 最新的问题
J
Java Code Geeks
P
Privacy & Cybersecurity Law Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 【当耐特】
博客园_首页
H
Hacker News: Front Page
T
Threatpost
Jina AI
Jina AI
博客园 - Franky
月光博客
月光博客
L
LINUX DO - 热门话题
The Cloudflare Blog
H
Heimdal Security Blog
博客园 - 司徒正美
酷 壳 – CoolShell
酷 壳 – CoolShell
Cloudbric
Cloudbric
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
S
Secure Thoughts
T
Tenable Blog
I
Intezer
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

Sanonz

使用 Invox Setup 实现 Electron 安装包界面美化 用 VS Code 编辑器开发 STM32 嵌入式 使用 FontCreator 编辑字体库 | Sanonz 使用 React Context API 和 Hooks 实现全局状态管理和性能优化 使用 Phonegap + Cordova 搭建混合开发平台 利用 Github Actions 自动部署 Hexo 博客 在 WEB 端实现亮/暗主题跟随系统功能 | Sanonz Metalness vs Specular Workflows for PBR Shading 以太坊概念与使用 wep3/infura 实现以太币及合约币交易流程 | Sanonz 实现树莓派(Raspberry Pi)联网发送本机IP到绑定的微信 | Sanonz 使用 Three.js 的 RenderTarget 实现离屏渲染 使用 redux-store-provider 简化 react 开发流程 浏览器 HTTP 并发请求规则探讨 | Sanonz JavaScript Event Loop、Micro Task、Macro Task WebAssembly 从入门到吃鸡 | Sanonz Let's Encrypt 使用教程,免费的 SSL 证书,让你的网站拥抱 HTTPS Let's Encrypt 使用教程,免费的 SSL 证书,让你的网站拥抱 HTTPS WebGL 三维教程 - 绘制矩形和点(二) | Sanonz WebGL 三维教程 - WebGL 介绍(一) Hexo 搭建静态博客与 hexo-theme-concise 主题使用教程 | Sanonz
Ubuntu 搭建 php、mysql、nginx 开发环境 | Sanonz
Sanonz · 2017-11-14 · via Sanonz

php 安装

进入 php 官方站点现在所需版本 http://php.net/downloads.php,提取下载地址使用 wget 进行下载:

1
2
$ cd /usr/local/
$ wget http://cn.php.net/distributions/php-7.1.11.tar.gz

解压文件

1
2
$ tar zxf php-7.1.11.tar.gz php-7.1.11-src
$ cd ./php-7.1.11-src

安装依赖库

1
$ apt install make build-essential libxml2-dev

具体的配置选项列表使用 ./configure --help 或者查看官方文档 http://php.net/manual/zh/configure.about.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ ./configure \
--prefix=/usr/local/php-7.1.11 \
--with-curl \
--with-zlib \
--with-iconv \
--with-xmlrpc \
--with-openssl \
--with-pcre-jit \
--with-pdo-mysql=shared,mysqlnd \
--without-pear \
--enable-xml \
--enable-fpm \
--disable-dom \
--enable-shared \
--enable-sockets \
--enable-mbstring \
--disable-rpath \
--disable-fileinfo

如果提示 Cannot find OpenSSL's <evp.h> 执行以下命令

1
$ apt install libssl-dev

如果提示 Cannot find OpenSSL's libraries 执行以下命令

1
2
3
$ find / -name libssl.so
/usr/lib/x86_64-linux-gnu/libssl.so
$ ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib

创建配置文件

1
2
$ cp ./lib/php.ini-development ./lib/php.ini
$ cp ./etc/php-fpm.conf.default ./etc/php-fpm.conf

mysql 安装

安装前可以使用以下命令查看当前的 mysql 版本:

1
2
3
4
5
6
7
$ apt show mysql-server
Package: mysql-server
Version: 5.7.20-0ubuntu0.16.04.1
Priority: optional
Section: database
Source: mysql-5.7
...

执行以下命令安装 mysql:

1
$ sudo apt install mysql-server

安装过程中需要输入密码:

然后在重复输入密码:

设置完成后等待自动安装即可,安装完成 mysql 默认就启动了,可以执行以下命令查看,只要看到出来一坨代码就说明已经启动成功。

1
$ ps -ef | grep mysqld

可以使用以下命令控制 mysql 服务:

1
2
3
$ service mysql stop
$ service mysql start
$ service mysql restart

使用以下命令进入 mysql shell 界面,按提示输入密码,可以使用 show databases 查看数据库列表,用 exit 命令退出 shell 界面:

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
26
27
$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.02 sec)

mysql> exit;
Bye

nginx 安装

执行以下命令安装 nginx

1
$ sudo apt install nginx

先启动 nginx,然后访问 ip 查看是否安装成功。

1
$ service nginx start

编辑 nginx 配置文件,添加 php 解析

1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {

...

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

...

}

新建 php 文件并访问

1
2
3
<?php

phpinfo();

完毕