I followed your tutorials on setting up Ubunto 18 server on windows 10, and then your other tutorial on installing Magento 2.3, and it all works perfectly, sort of.
The next logical step is how to work in the windows environment (simple text/php storm, copy/paste files into media), and those files having the correct permissions for Magento to work with.
I accomplished mapping a network drive using SSHFS
And then I mapped in widows to \sshfs\[email protected]\ … \ … \var\www<magento directory>\html (minus the spaces that I had to use to get the forum to show dots and back slashes)
And making sure to use a different login, and logging in as yourRemoteLogin (user called magento)
This allows me to see files, and even edit them, but they don’t seem to have the correct permissions, and I’ve only been able to get it to work when I use chmod -R 777
This is obviously not going to work for a real world scenario, where I’m going to use Git to publish my local work to my AWS account.
Wow, that was a lot, and not a very clean solution (even for just learning Magento). So, how do you recommend users work with the ubunto/magento files via windows (file explorer/editor) that solves all of these nasty permissions issues so Magento can see a new theme, files, etc.
Thanks for the great tutorials,
Hi @Oren_Tanay and welcome.
Thanks for the positive comment, I’m glad you managed to get something out of it.
As I mentioned in the tutorial, I don’t develop locally and so I have no experience to fall back on in order to answer your question. However, in my limited-experience I don’t believe Windows and Unix talk to each other very well when it comes to file permissions. So, I wouldn’t expect something like WinFSP, Drive Mounting (or similar) to work as the permissions would probably break the files.
Because running a Linux Web Server in a VirtualBox is almost exactly the same as interacting with any “actual” server… Can you not just setup your FTP/PhpStorm to interact with your files over FTP? That’s the way I’d do it, if I worked locally. And so long as Ubuntu on the VirtualBox has a connection to the web, then there’s no reason why you can’t initiate git and sync it to your Repo like you would in a real-world environment.
Someone who might be able to contribute is @PawelP. I know he’s spent a lot of time working with VirtualBox since I made the tutorial. Hopefully, he can weigh in and shed some light on how he does it. Plus as it seems you’re a PhpStorm user, you may be able to compare notes on some things that he’s been struggling with too (Developing with PhpStorm).
So, yes I use Oracle VM, pretty cool piece of soft. It is easy to back up, move data across to a different machine and so on. I really like it. I have probably 3 M installation on different stages to do test. At the same time I have to M installations on DigitalOcean.
I’m still learning and trying to drop putty, notepad++, and fillezilla and replace these with PHPStorm. I linked all my M installations with PhpStorm, mapped them with my local machine (I mean local directories on PC (created different project for different M) - I treat locally hosted M installation on Oracle like separate servers) and now I can work locally and deploy files from my projects to life environments. All good but i still don’t know how to preview my code and what it does before the deployment.
I still need to learn a lot but with PHPStorm you can switch Magento projects and servers only picking one from a drop down and work with your files locally.
We have a pretty effective solution to the problem that I’d like to share with you.
PhpStorm remote web server project setup:
- Select ‘Create New Project from Existing Files’
- Select ‘Web server is on remote host, files are accessible via FTP/SFTP/FTPS’
- Name your project, and specify where your local path will be (project files from remote server will be downloaded here)
- Leave ‘Deployment options’ on Default
- Add your remote server SFTP connection details. Make sure to use the user you created specifically for Magento as the SFTP username. Set root path to remote working directory of your project.
- Once connection details are confirmed, remote working directory files will be downloaded to the local directory specified in step 3. (this can take a while because it will copy your entire remote site to your local Windows 10 machine)
- Once remote files are downloaded, PhpStorm will open the project. At that point, navigate to Tools > Deployment and select Automatic Upload.
- Viola, you’re done.
Warning, if you edit any files on the remote server via nano / upgrade / git, then your local copy of the site will be out dated, and you’ll need to pull a clean copy down from your local server. I do this in PHPStorm by right clicking on the top directory of your project (usually left column) -> Deployment -> Download from “what you named your server”.
As I figure out a more efficient solution to this process I’ll be sure to update this post.
That it very useful. Thank you very much. Whatever you find out about PhpStorm & Magento please fire it here.
I mean anything, anything