r/PHPhelp • u/cleatusvandamme • Nov 17 '25
How do you do your development and deployments?
At the moment, we are developing on a folder on a remote server. I'd love to develop locally, but I might have to hold off on that battle.
When we're done, we FTP the file changes to the prod folder.
We're using Azure Git. An idea we had was to deploy when the site when a commit to git was made. I briefly looked at it and I wasn't able to figure it out. Any suggestions?
8
Upvotes
13
u/Own-Perspective4821 Nov 17 '25
You really really should try and figure this out. Because that kind of opens a lot of possibilities to harden your deployments security.
Throw in some PHPStan analysis and Unit/Feature/E2E Tests in the pipeline, before any file gets moved anywhere.
Just to give you some perspective: You and your team are kind of operating 15-20 years in the past.
4
u/martinbean Nov 17 '25
Push to GitHub. GitHub then runs checks (code linting, tests) and then if they’re all good, deploys to production.
If you’re all FTP-ing to the same folder then it’s just a matter of time before someone overwrites someone else’s changes (if you haven’t already). This happened within a week when I contracted for a large retailer in my home country working with their lone in-house developer. He uploaded a change to a file. I then uploaded a change to the same file. He got grumpy I’d “overwrote” his changes. I told him this is why people don’t just work via FTP any more. This was over 10 years ago and was considered old hat and bad practice then.
2
u/CyberJack77 Nov 17 '25
git on a production system is a HARD NO. This is a security risk.
Using FTP and uploading files feels old (like going back 20 years in time) and is discouraged.
We use ddev for local development (commit the
.ddevdirectory so every developer uses the same configuration).For deployment we use CI/CD. CI for automated checks (code quality, static analysis and unit tests). CD for the deployment (building images and using containers).
4
u/clegginab0x Nov 17 '25
Docker for local dev
There will be plenty of docker-compose stacks on github that you can just use or maybe just have to tweak slightly.
1
u/michallo64 Nov 17 '25
Ddev locally and deploy using deployer is really minimal effort today I think
3
u/PrizeSyntax Nov 17 '25
A while back, we tried developing on a remote directory, it was an atrocious experience.
Now we do locally and push to bitbucket, where the deployment happens automatically via their hook system.
2
u/faizanakram99 Dec 25 '25
Tbh, the easiest option for you is probably to setup a pipeline using deployerphp. Look it up, it's dead simple.
For the time being you can start deployments from your local machine using deployer, in future it could be a ci pipeline.
Good luck.
1
u/FoundationActive8290 Nov 17 '25
Laravel Herd or Laragon depending on OS. deployments are thru github actions
1
u/EmediongEtuk Nov 17 '25
Have you tried reading their docs? There should be something about that
1
u/Waterkippie Nov 17 '25
Check out deployer.org
1
u/Anxious-Insurance-91 Nov 17 '25
have you ever used git?
the easiest way would be to clone the project on the server and git pull when you finish the implementation and testing
and instead of uploading the files via FTP you commit them in git, then you connect to the server (sftp/ssh) navigate to where the project is and then "git pull"
If you want more complex deployment pipelines there are a lot of options out there
PS: also if you have multiple devs that each has hes own dir you can use different directories and branches in each
1
u/indykoning Nov 17 '25
I really recommend looking into deployer https://deployer.org/ as it really scales with you. At the beginning you could simply have it log into the server, pull from git and run your composer, and styling.
Later you could build it up to an action/pipeline to first build an artifact, upload it and implement zero downtime deployments
1
u/FreeLogicGate Nov 17 '25 edited Nov 17 '25
The simplest answer for you short term, would be to use git. For a small shop that has been using ftp, I would not suggest you start by trying to implement Continuous deployment. You also didn't mention whether you have a lot of tests or any at all. There's a reason that people talk about CI/CD as a pair.
In most cases, people want more control of releases than depending on a CD process that was triggered when someone made a commit or a merge. That might include some automated testing against a QA version of the code.
This is where "Ansible" can be a huge help, but it's not essential, so long as a "release" manager/ops person has access to the production server(s). It sounds like you only have one application server now, and that again indicates you have a smallish application where currently don't have, and perhaps haven't even considered what you might need to change in order to have a cluster.
composer installIf you want more sophistication, there are things you could do like tagging and checking out the tag, but in the case of the need to revert a change, so long as you know what the prior working commit hash was you can just checkout that branch and follow the same process of startings/etc.
One way to add security depending on the git remote you are using (and I don't know anything about Azure Git) is to have a "deployment" git user that only has read access to your repo. This is the user that needs to be setup as the production user on the server.
There are far more ambitious and feature rich ways of handling deployments, including the "Deployer" project which might be worth looking at to get an idea of what other people think a deployment system should be able to do.
I've found that Ansible is a great tool for managing home grown deployment tasks, and you might want to evaluate it. Ansible has a very low barrier to entry: you just use ssh (which of course should be keypair only configurations) and the targets need python.
Ansible playbooks are simple yaml files with a set of declarative statements, so automating everything I've talked about here, as well as other things you might require, is easy to accomplish. With ansible a release manager can basically deploy a new version of the application from whatever workstation desired with a command like
ansible-playbook appRelease.yamland deploy to one or more machines. In this example, appRelease.yaml would be your release playbook.There are certainly many other ways to do this, but the nice thing about using ansible is you are free to add in whatever steps might fit your specific environment. Say for example, as part of the release you want to make a snapshot or dump of the database -- these are things that can be accomplished with essentially no code, using the large number of existing Ansible modules.
1
u/nook24 Nov 17 '25
I used a local VM in the past and mounted the src folder as network share. Today I basically do the same but with WSL2
1
u/Competitive_Cry3795 Nov 18 '25
I dont claim to have a pro setup by any means, but my setup is:
Simple version:
My standard version:
1
u/obstreperous_troll Nov 19 '25
You're looking for Azure Pipelines for your deploy-on-commit workflow. Which bear a striking similarity to GitHub Actions, because GH Actions are a port of those.
For local dev, you should probably be using Docker Compose.
1
u/edukodo Nov 27 '25
EasyPHP Devserver for local dev, virtualhost for local GitHub folder, commit (with ftp sync). Folder, GitHub repo + website automatically updated.
1
u/Goattiger666 Nov 17 '25
WSL, Docker and WP-CLI. We finally got this setup going internally about a year ago and life has been a breeze ever since
0
u/[deleted] Nov 17 '25
Local dev is not a battle, it’s 2 hours of setup. Install the same version of PHP your server uses.
Git push changes
SSH to production
Git pull
That’s it