简体   繁体   English

如何在服务器上运行PHP脚本而不更新服务器文件

[英]How to run PHP scripts on server without updating server's files

I need to run PHP scripts on server without having to update files it stores - perform testing on real server before deployment. 我需要在服务器上运行PHP脚本而不必更新其存储的文件-部署前在真实服务器上执行测试。 Server has access to database which is inaccessible from outside. 服务器有权访问无法从外部访问的数据库。 For this reason I can't run my scripts locally, I need to run them within server's environment, but I don't want to update files stored on server. 因此,我无法在本地运行脚本,我需要在服务器环境中运行脚本,但是我不想更新存储在服务器上的文件。 Is there any way to do so? 有什么办法吗? Is there a tool for remote PHP debugging? 是否有用于远程PHP调试的工具?

There are several ways to achieve this thing 有几种方法可以实现这一目标

  1. You can export database from live server and import it to your local server for testing and debugging purpose. 您可以从实时服务器导出数据库,然后将其导入本地服务器以进行测试和调试。
  2. You can Upload code into a separate folder or subdomain on server to connect with database and test with live server configurations. 您可以将代码上传到服务器上的单独文件夹或子域中,以与数据库连接并使用实时服务器配置进行测试。 Once you are satisfied replace live files. 满意后,请替换实时文件。

I have found a solution - XDebug for PHP. 我找到了一个解决方案-XDebug for PHP。 However as was mentioned in comments, testing against copy of DB and using virtualization is a more common approach, which I personally will probably stick to. 但是,正如评论中提到的那样,针对数据库副本进行测试并使用虚拟化是一种更常见的方法,我个人可能会坚持使用。 For those who are still determined to go the "hard" way, here is a link to HOWTO on XDebug installation for PHP on Ubuntu - http://ubuntuforums.org/showthread.php?t=525257 . 对于那些谁仍然决定去“硬”的方式,这里是在Ubuntu到HOWTO的链路上的XDebug安装了PHP - http://ubuntuforums.org/showthread.php?t=525257

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM