php 远程编辑,xdebug调试代码

背景介绍:LAMP开发是很多公司喜欢采用的技术组合,故而做php开发,使用linux环境也是很多公司的要求。本文就来介绍下如何在windows下,使用phpstorm集成开发环境,来开发放在linux虚拟机的PHP项目。

环境介绍:win10系统,phpstorm,虚拟主机centos7版。

1、创建工程

1.png

2 选择如下选项

2.png

3 命名项目

3.png

 4 如果已经配置好sftp,直接使用即可。或者创建新的连接。

4.png

5 点击Project Root,下一步。

5.png


如果想文件一更新,就保存在远程linux上,也很简单,勾选自动保存选项。upload changes files automatically to the default server: Always

7.png

8.png


xdebug远程调试代码

本项目php7.1.3,xdebug2.5.0

###############################安装debug##################################

[root@localhost ~]#  wget http://xdebug.org/files/xdebug-2.5.0.tgz

[root@localhost ~]# tar xvzf xdebug-2.5.0.tgz

[root@localhost ~]# cd xdebug-2.5.0

[root@localhost xdebug-2.5.0]# ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config

[root@localhost xdebug-2.5.0]# make

[root@localhost xdebug-2.5.0]# make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/


[root@localhost php]# vim /usr/local/php/etc/php.ini


末尾加上:

[xdebug]
zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" 
xdebug.remote_enable = 1
xdebug.remote_handler="dbgp"
xdebug.remote_host=本地ip
xdebug.remote_autostart= off
xdebug.idekey="PHPSTORM"
xdebug.remote_port = 9001      //本项目为nginx,占用9000端口,故改为9001


[root@localhost php]# service php-fpm reload

#########################################安装debug完成##########################

################################配置phpstorm#######################################

配置Server


9.png

配置DBGp Proxy

10.png


开始调试

打开项目的运行配置,选择“PHP Web Application”

11.png



其他调试过程与本地xdebug调试一致,可自行百度

2017.4.14   /   热度:2389   /   分类: php

发表评论:

©地球仪的BLOG  |  Powered by Emlog