This article requires Windows 10 (Build Version 1709 [The Fall Creators Update]) or above to work.
Although WSL exists since Version 1607 [Anniversary Update], it’s harder to setup and more buggy.
In this tutorial we will setup this development environment in WSL (In Part 1)
PHP 7.2 (Run as FPM)
With those tools under Windows 10 (In Part 2)
Bash and Linux CLI tools
Continue reading “[WSL] PHP Development Environment by “Windows Subsystem for Linux” (Part 1)”
Deployer – https://deployer.org/
A zero downtime PHP deployment tool.
How it works?
SSH into the remote server,
git clone to new folder,
composer install, and create symlink to latest release folder
And optionally run database migration, restart PHP-FPM. If either step fails, it rollbacks the whole transaction.
Continue reading “[Windows/Linux/Mac][PHP Deployer] Zero Downtime PHP Deployment”
In a recent project, I am finding way to display current git branch on the backend dashboard.
Without a application dependent library, executing CLI
git seems to be the fastest way.
i.e. The exactly same syntax as we use in bash/cmd/powershell.
$currentBranch = exec('git rev-parse --abbrev-ref HEAD');
However, it worked in production/staging Linux machine, but not in local Windows machine.
It does work if I specify the absolute path
C:\Program Files\Git\bin\git.exe, but it’s not optimal because it will be machine dependent.
After a while, I figure out the environment
PATH variable is missing in Windows that cause
git not being picked up.
The trick is, add this line before
exec call to:
putenv('PATH=' . $_SERVER['PATH']);