安装虚拟机
VMware Workstation Pro
安装CentOS
CentOS-7-x86_64-Minimal-1708.iso
安装FinalShell
教程地址
安装lnmp
教程地址
服务状态管理命令
1、安装lnmp
2、安装memcache、redis
3、安装opcache
4、安装swoole
5、添加虚拟主机
6、上传项目
安装swoole
pecl install swoole
启动swoole
cd到项目下执行: php index.php
停止swoole
1.查找进程pid编号:netstat -apn | grep 9503
(9503为启动swoole时监听的端口号)
执行后会出现:
"tcp 0 0 0.0.0.0:9501 0.0.0.0:* LISTEN 73731/php"
73731为pid
2.干掉进程:kill -9 73731
3.干掉所有php进程:killall php
Redis
安装php redis扩展:pecl install redis
reids启动:cd /root/lnmp1.5/src/redis-4.0.6/src
./redis-server ../redis.conf
win启动: redis-server redis.windows.conf
centos安装xdebug
1.首先安装和你php版本对应的xdebug
2.对下载下来的文件进行编译(依次执行下面的命令)
- tar zxvf xdebug-2.8.0alpha1.tgz
- cd xdebug-2.8.0alpha1
- /usr/local/php/bin/phpize
- ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
- make
- make install
安装成功会出现如下所示:
+----------------------------------------------------------------------+
| |
| INSTALLATION INSTRUCTIONS |
| ========================= |
| |
| See https://xdebug.org/install.php#configure-php for instructions |
| on how to enable Xdebug for PHP. |
| |
| Documentation is available online as well: |
| - A list of all settings: https://xdebug.org/docs-settings.php |
| - A list of all functions: https://xdebug.org/docs-functions.php |
| - Profiling instructions: https://xdebug.org/docs-profiling2.php |
| - Remote debugging: https://xdebug.org/docs-debugger.php |
| |
| |
| NOTE: Please disregard the message |
| You should add "extension=xdebug.so" to php.ini |
| that is emitted by the PECL installer. This does not work for |
| Xdebug. |
| |
+----------------------------------------------------------------------+
3.修改php.ini配置文件 (remote_host为ssh主机地址ip)
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_enable = on
xdebug.remote_autostart = 1
xdebug.remote_port = 9000
;xdebug.remote_connect_back = 1
xdebug.remote_host = 192.168.20.12
xdebug.auto_trace = 1
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.remote_log = /tmp/xdebug.log
vscode 配置
1. vscode连接ssh成功,安装对应的插件
* PHP Debug
* PHP Intelephense
2. 修改settings(注意不是修改本地的,是连接ssh后会出现一个ssh远程的配置文件)
```"php.validate.executablePath": "/usr/bin/php",```
3.f5开启debug访问你的网站就可以了
其它配置
1.centos安装wget
yum -y install wget
yum -y install setup
yum -y install perl
2.重启fpm
/etc/init.d/php-fpm restart
转载于:https://www.cnblogs.com/ashidamana/p/9870233.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)