How do you work with remote projects and PhpStorm? - phpstorm

My setup is like this:
The project runs on a LAMP server. I cant run the project on my working machines, they are Windows based and the project needs Linux.
My IDEs are on different Windows machines (work, home, other_work).
#work I have PhpStorm #other_work I use a SSH client and edit files with nano or vim and #home I use PhpEd.
How can I keep my project in sync with PhpStorm?
In PhpEd I had never such problems every change is instantly visible in the IDE. I know that I can use the remote Host to see the actual files and change them, but I want to use the project features from the IDE like go to definition.
Has anyone solved this problem?

Related

How to edit code on server directly in VScode

I am writing code that will be deployed to a server. Right now I have to upload the code each time I change it. Is there any way to edit the code live on the server in Visual Studio code?
As there are some extension in the editor who provide that function this can be done in VS Code very simple. Just search in extensions for Keyword 'FTP' ...
Two Examples:
https://marketplace.visualstudio.com/items?itemName=humy2833.ftp-simple
https://marketplace.visualstudio.com/items?itemName=lukasz-wronski.ftp-sync
Both are very popular.
At the moment I personally use FTP-Simple. But have a look on your own. It depends on the things you wonna do. And don't worry ... it's a little bit tricky at the beginning to figure out how to setup and how they work ... but when you are in it works fine.
It depends what hosting you are deploying to. You can SSH into your server with most providers and use a command line editor such as nano or vim. Keep in mind, this won't keep the version on your computer up to date and the changes will be overwritten if you redeploy. Alternatively, If you have a VPS and want to edit the files in an IDE on your local computer, maybe a file transfer system like FTP or SMB would work. I don't suggest it though, there are huge security issues with them.
For Azure web apps, I've found that the Azure plugin for VScode is a quick and easy way to deploy my app. It's not quite real time but it's very easy to redeploy after updating. https://code.visualstudio.com/docs/azure/extensions
This is what I use to connect remotely to a couple Raspberry Pis, and a home server.
https://code.visualstudio.com/docs/remote/ssh

Pulling remote changes from a development server in PhpStorm

For most projects, I work in a local Dockerized setup, but once in awhile, I have to work on a project that lives on a remote development server. Using tools > deployment > configuration, I have set up sftp access to the server.
Now I can't seem to find a way to download the relevant files from that server.
I could swear that there used to be a menu option under Tools > Deployment to do this. Something like pull files from server.
Did this option go away with a recent update? Is there another way to do this from within the IDE (preferably without pushing to version control every time I want to test a change)?
===
Edit: I am using PhpStorm 2019.2. The contents of the Deployment submenu are:
Configuration
Options
Automatic Upload
Browse Remote Host
I have tested the sftp connection from within the configuration screen in PhpStorm, and it is working. Browse Remote Host also appears to work.

Duplicating existing cakephp app for development

I need to make a development version of a cakePHP app with its own db so that a developer can work on it without disturbing the current users.
I thought it would be simple, I just copied the entire director /project to /project_dev and then copied the DB "project_db" to "project_db_dev". Then I went into /project_dev/config/database.php and changed the db to "project_db_dev".
When I went to see what I had done, I saw the app was still connecting to the same db, as if I'd changed nothing. I realized that the original folder name was referenced in /app/webroot/.htaccess so do I need to find/replace all instances of that folder name?
What steps should I follow to duplicate an existing cakePHP app?
You need to setup some kind of development lifecycle.
Generally speaking the developer shouldn't be doing any development on the server. The best way to handle it is locally using a stack of some kind such as Lamp (Linux, Apache, Mysql, PHP) switch out linux with other OS's. There are multiple cloud solution to these environments to such as Koding.com
Using something like Git for version control the developer can develop locally then push the code through to the server after is being thoroughly tested locally or on a dev server or some kind.
Keeping Dev work and Live work away from each other is key.
Could do with a bit more information.
If both databases are hosted on the same server and you have permission to access them both with the same user then all you have to do is change the name of the database in your database.php
If not you will also have to update the IP and any other additional settings port etc.
If you are still having troubles email me simpsond1988#gmail.com

Building a web page without having internet access

I want to build a web site using my laptop in areas where I often do not have internet access - no active browser. How do I check my pages to see how things are going without a browser?
Just drag-and-drop the .html file into your favourite web-browser. It should open up with the "file:///" protocol automatically.
You should always have a local web server installed on your machine for development.
For example, Mac OSX comes with Apache pre-installed. You might have to activate it. You can also install a server language like PHP or Python. Again, OSX comes with those pre-installed, might just need activation. Google how to set up a local server on the type of OS you have.
You should try to replicate the type of server setup you will be using in production.
That will permit you to code locally and test in your browser.
You should also use some kind of versioning system like Git. So, you code on your local machine, then you can push your code to the cloud once in a while for backup. When you're ready, upload your code to the production server and try it out.

Can I run (XAMPP) MySQl inside my DropBox folder?

Lots of conflicting reports out there when I google; can anyone help?
Basically I want to have the same databases available at work & home PCs, for development porpoises only.
I will only ever be physically at one PC (with a 45 minute trip between) and only then will there be database access. The MySql service will be running on both, but only one will be write/reading the database. Both run Windows 7
I don't need to bother with symlinks, junctions, etc as I have enough space in my DropBox to install all of Xampp there.
Can I do that without corruption?
I use something similar as part of my remote development testing, I have never tried to run a large set of data from this or a production database. Haha, but for testing queries and setting up a couple rows, etc... I use something very similar with little to no problems.
I believe that you can run the portable xampp and mysql from your Dropbox just go to www.portableapps.com to get the xampp and also download the portable launcher from the link on the page.
Let XAMPP server run on your computers, and the data folder saved on your cloud (DropBox, SkyDrive, etc).
You should install XAMPP portable on your root folder (c:) that is the same on all computer you use, then you can move XAMPP data folder (xampp Apache htdocs) and MySQL data (xampp Mysql/data) folder to Dropbox.
Do not use XAMPP installer, but use the portable one.
Configure the folder settings on both Apache and MySQL config file:
C:\xampp\apache\conf\httpd.conf
C:\xampp\apache\conf\extra\httpd-ssl.conf
C:\xampp\apache\conf\extra\httpd-xampp.conf
C:\xampp\mysql\bin\my.ini
Do the same with other server that you use (PostgreSQL, etc).
Make sure that you:
Always turn off XAMPP server after using on each PC.
Always sync Dropbox before changing PC, that is before logging on and after logging off on different computer.
Mind host / local domain variable on each computer.
Its probably better to use same username for all computer you want to use to run the data folder.
Other method is using PortableAppas.com, that is running the apps directly from USB.