I'm using phpstorm to develop moodle for my company, the moodle is on the company's server, how do I check if there is xdebug installed on the server. If not, how to install it? If yes, how to configure phpstorm and how to debugging? Thanks!
我正在使用phpstorm为我的公司开发moodle,moodle在公司的服务器上,我该如何检查服务器上是否安装了xdebug。如果没有,如何安装?如果是,如何配置phpstorm以及如何调试?谢谢!
1 个解决方案
#1
Ideally you are developing on a local copy of the company's Moodle installation, and not directly in production. One very helpful tool for this is Vagrant, which helps with managing virtual machines. You would create a local version of your web hosting environment that matches your production hosting environment as closely as possible, with the exception of additional development tools installed, such as xdebug.
理想情况下,您正在开发公司Moodle安装的本地副本,而不是直接在生产中。一个非常有用的工具是Vagrant,它可以帮助管理虚拟机。除了安装了其他开发工具(例如xdebug)之外,您将尽可能创建与您的生产托管环境匹配的Web托管环境的本地版本。
If you do have to develop on production, you can check if xdebug is installed by trying two things depending on your access to the machine.
如果您必须在生产中进行开发,则可以通过尝试两种操作来检查是否安装了xdebug,具体取决于您对计算机的访问权限。
-
SSH: at the server's command line, run
php -i | grep xdebug
. If the server has xdebug installed, you will see some config output.SSH:在服务器的命令行,运行php -i | grep xdebug。如果服务器安装了xdebug,您将看到一些配置输出。
-
phpinfo(): if you can't ssh in but you can run code in production, create a page that executes the php function
phpinfo();
only, then visit that page. You will see a dump of all php config info. Do a find with your browser's search forxdebug
, and if you see anything, then it is installed. It may not be enabled but that's a different question which you should get used to Googling for.phpinfo():如果你不能ssh但你可以在生产中运行代码,创建一个执行php函数phpinfo()的页面;只有,然后访问该页面。您将看到所有php配置信息的转储。使用浏览器搜索xdebug进行查找,如果看到任何内容,则会安装。它可能没有启用,但这是一个不同的问题,你应该习惯谷歌搜索。
As far as phpstorm and xdebug goes, follow the documention and it will probably work assuming your server is set up as required. The problem with working in production on machines you don't control is that you probably won't have the access you need to configure things as needed, beyond the fact that developing on production is just a bad idea in the first place.
就phpstorm和xdebug而言,请按照文档进行操作,假设您的服务器已根据需要进行设置,它可能会起作用。在你无法控制的机器上进行生产工作的问题是,你可能根本不需要配置所需的访问权限,除了首先开发生产只是一个坏主意的事实。
I highly recommend setting up a local dev environment with Vagrant.
我强烈建议使用Vagrant设置本地开发环境。
#1
Ideally you are developing on a local copy of the company's Moodle installation, and not directly in production. One very helpful tool for this is Vagrant, which helps with managing virtual machines. You would create a local version of your web hosting environment that matches your production hosting environment as closely as possible, with the exception of additional development tools installed, such as xdebug.
理想情况下,您正在开发公司Moodle安装的本地副本,而不是直接在生产中。一个非常有用的工具是Vagrant,它可以帮助管理虚拟机。除了安装了其他开发工具(例如xdebug)之外,您将尽可能创建与您的生产托管环境匹配的Web托管环境的本地版本。
If you do have to develop on production, you can check if xdebug is installed by trying two things depending on your access to the machine.
如果您必须在生产中进行开发,则可以通过尝试两种操作来检查是否安装了xdebug,具体取决于您对计算机的访问权限。
-
SSH: at the server's command line, run
php -i | grep xdebug
. If the server has xdebug installed, you will see some config output.SSH:在服务器的命令行,运行php -i | grep xdebug。如果服务器安装了xdebug,您将看到一些配置输出。
-
phpinfo(): if you can't ssh in but you can run code in production, create a page that executes the php function
phpinfo();
only, then visit that page. You will see a dump of all php config info. Do a find with your browser's search forxdebug
, and if you see anything, then it is installed. It may not be enabled but that's a different question which you should get used to Googling for.phpinfo():如果你不能ssh但你可以在生产中运行代码,创建一个执行php函数phpinfo()的页面;只有,然后访问该页面。您将看到所有php配置信息的转储。使用浏览器搜索xdebug进行查找,如果看到任何内容,则会安装。它可能没有启用,但这是一个不同的问题,你应该习惯谷歌搜索。
As far as phpstorm and xdebug goes, follow the documention and it will probably work assuming your server is set up as required. The problem with working in production on machines you don't control is that you probably won't have the access you need to configure things as needed, beyond the fact that developing on production is just a bad idea in the first place.
就phpstorm和xdebug而言,请按照文档进行操作,假设您的服务器已根据需要进行设置,它可能会起作用。在你无法控制的机器上进行生产工作的问题是,你可能根本不需要配置所需的访问权限,除了首先开发生产只是一个坏主意的事实。
I highly recommend setting up a local dev environment with Vagrant.
我强烈建议使用Vagrant设置本地开发环境。