Great effort for this tutorial, thanks a ton, here are my notes if may help anyone, considering default install on WSL2 container
Note: composer added for Laravel framework.
These are NOT to be copy and pasted as it is, need to be selective as there are annotations beside some commands,
Also I've commented # some of the defaults written by the original editor due to mismatch to my current environment.
sha256sum php-x.x.x.tar.gz => e847745fd66fc8c57fac993a609fefcded93fddccd225f0620a26bb5ae5753c3
tar zxf php-x.x.x
sudo apt install build-essential
sudo apt install -y composer nginx pkgconf libxml2-dev libsqlite3-dev zlib1g-dev
cd php-x.x.x
./configure --enable-fpm --with-mysqli <==Thank you for installing PHP.
make <== takes a while
sudo make test <== optional as recommended
sudo make install <= /usr/local/bin /usr/local/php
sudo cp php.ini-development /usr/local/lib/php.ini
sudo cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
sudo cp sapi/fpm/php-fpm /usr/local/bin
sudo vim /usr/local/php/php.ini <= cgi.fix_pathinfo=0
sudo vim /usr/local/etc/php-fpm.d/www.conf <= user=www-data group=www-data
sudo vim sapi/fpm/php-fpm.conf <= edit include=etc/php-fpm.d/*.conf <- relative path
sudo cp sapi/fpm/php-fpm.conf /usr/local/etc
/usr/local/bin/php -v <= $PATH$ uses /usr/local/bin at first /usr/local/lib/php.ini
sudo /usr/local/bin/php-fpm <= start the service
sudo vim /etc/nginx/sites-available/default <= edit the following under server {}
location / {
#root html;
#index index.php index.html index.htm;
}
location ~* \.php$ {
#fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
*Restart nginx (root /var/www/html) if root path doesn't exist, default is: /usr/share/nginx/html
sudo nginx -t <= Test Nginx conf files
sudo service nginx reload
sudo service nginx stop
sudo service nginx start <= [OK]
php-fpm needs to be in a service, or kill process manually ps -aux | grep php-fpm ; kill <pid>