I have spent several hours on the maze of eclipse's setting trying to find out how to debug a remote website but still can't get it to work.
This SO is exactly what I was about to ask, after reading it, I still have something that needs to be clarified so that I can do further research.
1)It says I still need a local version of the website to be able to debug it. I don't get it: if I have to have a local version, why is it called remote debug? Is any change I make to local automatically synchronized to the remote server? Seems no because according to the question I need to manually FTP files to the server?
2)What I am trying to achieve is: with the IDE listening, when I refresh the remote webpage, the IDE takes over and displays the PHP file in its editor. Then I can debug and make changes to it, when I click save, the remote file will also be modified, is this possible at all?
1) You need only the project opened in eclipse. No need to host it in your local machine. Local changes will not be automatically propagated to server until you FTP or rsync.
2) You can add break points in your IDE. Refresh webpage. When it hits break point the IDE will be automatically open(IDE should be configured to listen to remote debug connections) and stops at the line having break point.
You can use IDE plugins to automatically upload file to server and propagate the change. I'm using PHPStorm IDE for achieving the same.
Autoupload
Related
I'm using XDebug with VS Code, and it works flawlessly when I'm debugging something locally. I can step through the breakpoints of each request sequentially in a sane, logical manner.
However, if I try to debug something remote, the requests come in immediately and flood the call stack:
This makes things incredibly difficult to trace. In the middle of looking at a breakpoint, a new request will come in, the window will pop over to that breakpoint, and I'll lose my spot. Why is this happening?
Note: my remote setup is pretty simple:
I'm using a simple SSH tunnel for port 9000 from the server to my local system
The remote files are mounted to my local system using SSHFS, and I opened that location using VS Code
In my launch.json, I have pathMappings configured to "/remote/system/files": "${workspaceFolder}/" so that the debugger knows where to look for the source.
I need to run PHP scripts on server without having to update files it stores - perform testing on real server before deployment. 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?
There are several ways to achieve this thing
You can export database from live server and import it to your local server for testing and debugging purpose.
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. 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.
I am developing a php script locally using XAMPP, it is working on my local server, but after being uploaded to the linux live server, there are many things those won't work. Most of the problems are caused by file path writing.
For example:
require('inc/config.php') working in XAMPP but it does not work on live server or vice versa. So I need to change it to require('config.php') in order to make it able to be called on live server.
That seem like ruining the whole of my works and make the times I invested become useless.
My question:
What's the common solution can I use to prevent that kind of problem? Is using full path to call a file the best practice?
Is there any local development environment for Windows like XAMPP that able to simulate linux server structure, so there will be nothing need to be fixed after finishing development on local server then upload it to linux live server?
Please somebody help..
Best Regards
You don't need to change anything, just in the index.php give your script proper path to your scripts using set_include_path().
I got kind of a problem, I can't figure out.
I got a local development server set up in my office and an other online dedicated server, to test my web-apps on.
That's all fine as long as I work in my office and use the LAN/WLAN.
But sometimes I'd like to do some quick code changes at home. There's where my problem starts. I tried several possibilities. FTP, VPN, WebDAV, ...
It does work, but the speed is incredibly slow. I need 5 min to chance one or two lines of code.
How's your development environment set up and what option should I use to make the "connection" become faster?
Thank's in advance
Typically extreme slow downs like this are due to the IDE you are using. It wants to read and parse everything in the "project" for you, and it is doing that over a slow connection (ftp, sftp, ssh, etc.).
If you are using dreamweaver, check out this KB Article and this Google Search.
Ultimately, you are going to have some performance hit, but you should be able to configure your IDE to minimize that. You can also always drop back to using something like FileZilla or WinSCP plus your favorite editor ... perhaps Sublime Text with Remote Access.
Trying to do dev over remote file system access is painfully slow. A few options:
Use Remote Desktop (RDP) to connect into your machine and do local dev.
You can always go the skydrive / google drive / dropbox route that syncs your dev files to your home computer so you can have local copies on both.
Don't discount source control (though with that you can only make updates to what was checked in, so if you left the office without a checkin, you won't be able to do anything about it from home).
We are working on a project which is getting bigger and bigger.
Till now our work looked like this:
I have a web server, I'm coding with VIM directly over SSH
Another programmer send me new files I add them and integrate them (he have a copy of project and local server)
Designer sends me design I also integrate it.
It is pretty much waste of time, because every time they made change I have to integrate it.
Now we have a hosting which doesn't support SSH (I cannot use vim now). How should we work on a project like this? How should I set up my VIM to work on remote project (I don't want to download and upload every time I want to change file)?
You didn't mention your OS. That would be certainly hepful if you want a precise answer.
The first thing would be to find a better host. You can rent very decent dedicated servers for as low as 40 or 50 € or less. If your project is big and serious, 50 €/month or 100 €, or 200 € is perfectly acceptable and you can install/enable whatever you need. Depending on the size of your project, a VPS could be enough. Whatever the price, a web host without SSH access is worse than shit.
But you may not have any power on that area.
Since your server doesn't support SSH, a proper VCS is not an option. The only practical solutions I see are rather "old-school" but they work:
Solution A:
Download the whole site on your local machine with an FTP client.
Edit locally.
Test your changes with a local web server.
Upload the changed files when your tests are OK.
Solution B:
Connect to your server with an FTP client.
Use its "Edit Locally" feature to open the files in Vim.
Write your changes, the file is automatically updated on the server.
Solution C:
Use Vim's bundled netrw plugin: :e ftp://host/path/to/file. See :h netrw.
Note that the process will always be download -> edit -> save -> upload, whether you notice it or not. Depending on the solution you choose, the process can be horribly repetitive and inneficient or almost completely invisible.
But, seriously, get another server and use a VCS and a local server.
I recommend using version management software like git with SSH hooks that automatically upload changes to your server.
You can use a version manager, like git and make a git pull in the web server every time you have a stable version.
You collaborator can push the new content and you dont need manage the file youtself.