1. apache 的www代码位置
Library/WebServer/Documents
将Documents文件夹权限777或者其子文件夹才能放正常放置部署代码,这里我直接把跟目录设置成777:
cd Library/WebServer
chomd -R 777 Documents
配置.htaccess文件,并放在Documents目录,.htaccess文件内容如下:
<Files *>
Options -Indexes
</Files>
1-1 开启php模块:
编辑配置文件 sudo vi /etc/apached2/httpd.conf
打开此注释 LoadModule php7_module libexec/apache2/libphp7.so
重启 sudo apachectl restart
2. 启动关闭apache
停止:sudo apachectl stop
开启:sudo apachectl start
重启:sudo apachectl restart
3. 安装mysql:
3-1)下载Mysql:https://dev.mysql.com/downloads/mysql/
3-2)整个命令过程如下:
seedeMacBook-Pro:~ see$ cd /usr/local/mysql/bin/
seedeMacBook-Pro:bin see$ sudo su
Password:
sh-3.2# ./mysqld_safe --skip-grant-tables &
[1] 997
sh-3.2# 2018-12-01T09:58:34.6NZ mysqld_safe Logging to '/usr/local/mysql-5.7.24-macos10.14-x86_64/data/seedeMacBook-Pro.local.err'.
2018-12-01T09:58:34.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.7.24-macos10.14-x86_64/data
sh-3.2# ./mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)
mysql>
3-3)其他:
(1:
停止Mysql服务 sudo /usr/local/mysql/support-files/mysql.server stop
(2:
进入终端输入:cd /usr/local/mysql/bin/
回车后;
登录管理员权限 sudo su
回车后;
输入以下命令来禁止mysql验证功能 ./mysqld_safe --skip-grant-tables &
回车后mysql会自动重启(偏好设置中mysql的状态会变成running)
(3.
输入命令 ./mysql
回车后,
输入命令 FLUSH PRIVILEGES;
回车后,输入命令 ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码';
(设置Mysql密码:参考https://blog.csdn.net/pariese/article/details/77527813)
4. 类似于win的xshell终端软件,当然不是一个思路
推荐用iterm 下载 https://www.iterm2.com/
利用ssh远程连接(登录)centos
ssh root@123.123.123.123 -p 22
5. 阿里云oss browser客户端(多端支持)存放一些不经常读写的文件或者大文件
7. navicat
8. Mac安装Redis
9. laravel配置redis。ThinkPHP5配置redis。
好了主要是这些了。
--------------------
--------------------
经过实践,建议不要在本机上安装后端开发环境,毕竟与真实服务器环境相比,本机(如Mac、Win)原始开发环境差太多。
所以建议,在Vmware 虚拟机中安装Centos,模拟真实开发环境。这个样环境真实,而且环境好移植。
--------------------
安装PHP主环境:
方法一:宝塔面板 https://www.bt.cn/
方法二:一键lnmp https://lnmp.org/install.html ,这个需要再次安装自定义扩展,如vsftp、memcached。
--------------------