Skip to content

Commit

Permalink
Fix and improve WSL process (#1949)
Browse files Browse the repository at this point in the history
* Save information for features

* Uncomment xdebug configuration on php8.1

* Fix wrong path

Should be in the users home directory, not root

* Enable php 8.2 and 8.3 fpm and restart

Just like other php versions

* Save features in user folder, username/group in root

* Fix php fpm user/group config

* Use WSL_USER_NAME for composer

* Use existing scripts for mariadb and php83 in wsl-init

They do the same thing, prevent copy/pasting and what not

* Fix restarting nginx in wsl:create-sites

nginx didn't allow to restart as the restart command was in a loop and resulted in

```
Feb 03 15:09:01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Feb 03 15:09:01 systemd[1]: nginx.service: Start request repeated too quickly.
Feb 03 15:09:01 systemd[1]: nginx.service: Failed with result 'exit-code'.
```

So just restart once at the end :)

* Prevent mariadb deprecation warning

* Also check if fpm is enabled for php 8.2/8.3

* Edit for styleci

* Use $WSL_USER_NAME, $$WSL_USER_GROUP where necessary in features

* Restart newer php fpms too with blackfire and couchdb
  • Loading branch information
MichaelBelgium authored Feb 28, 2024
1 parent 5125ef3 commit f180742
Show file tree
Hide file tree
Showing 19 changed files with 108 additions and 173 deletions.
128 changes: 23 additions & 105 deletions bin/wsl-init
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ read WSL_USER_NAME
echo "What is your WSL user group? (Same as username if you're unsure)"
read WSL_USER_GROUP

# Save necessary information for features
mkdir -p ~/.homestead-features
mkdir -p /home/$WSL_USER_NAME/.homestead-features
echo $WSL_USER_NAME > ~/.homestead-features/wsl_user_name
echo $WSL_USER_GROUP > ~/.homestead-features/wsl_user_group

# Update Package List
apt-get update

Expand Down Expand Up @@ -50,41 +56,19 @@ apt-get install -y --allow-change-held-packages \
php-imagick php-memcached php-redis php-xdebug php-dev php-swoole

# PHP 8.3
apt-get install -y --allow-change-held-packages \
php8.3 php8.3-bcmath php8.3-bz2 php8.3-cgi php8.3-cli php8.3-common php8.3-curl php8.3-dba php8.3-dev \
php8.3-enchant php8.3-fpm php8.3-gd php8.3-gmp php8.3-imap php8.3-interbase php8.3-intl php8.3-ldap \
php8.3-mbstring php8.3-mysql php8.3-odbc php8.3-opcache php8.3-pgsql php8.3-phpdbg php8.3-pspell php8.3-readline \
php8.3-snmp php8.3-soap php8.3-sqlite3 php8.3-sybase php8.3-tidy php8.3-xml php8.3-xsl \
php8.3-zip php8.3-imagick php8.3-memcached php8.3-redis php8.3-xmlrpc php8.3-xdebug

# Configure php.ini for CLI
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/cli/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/cli/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/cli/php.ini

# Configure Xdebug
echo "xdebug.mode = debug" >> /etc/php/8.3/mods-available/xdebug.ini
echo "xdebug.discover_client_host = true" >> /etc/php/8.3/mods-available/xdebug.ini
echo "xdebug.client_port = 9003" >> /etc/php/8.3/mods-available/xdebug.ini
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.3/mods-available/xdebug.ini
echo "opcache.revalidate_freq = 0" >> /etc/php/8.3/mods-available/opcache.ini

# Fixed php fpm bind listening socket - no such file issue.
mkdir -p /run/php
touch /run/php/php8.3-fpm.sock

# Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chown -R vagrant:vagrant /home/vagrant/.config

# Install Global Packages
sudo su vagrant <<'EOF'
/usr/local/bin/composer global require "laravel/envoy=^2.0"
/usr/local/bin/composer global require "laravel/installer=^5.0"
/usr/local/bin/composer global config --no-plugins allow-plugins.slince/composer-registry-manager true
/usr/local/bin/composer global require "slince/composer-registry-manager=^2.0"
bash 'scripts/features/php8.3.sh'

# Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.config

# Install Global Packages
sudo su $WSL_USER_NAME <<'EOF'
/usr/local/bin/composer global require "laravel/envoy=^2.0"
/usr/local/bin/composer global require "laravel/installer=^5.0"
/usr/local/bin/composer global config --no-plugins allow-plugins.slince/composer-registry-manager true
/usr/local/bin/composer global require "slince/composer-registry-manager=^2.0"
EOF

# Install Nginx
Expand All @@ -99,36 +83,14 @@ chown -R $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME
touch /home/$WSL_USER_NAME/.config/nginx/nginx.conf
ln -sf /home/$WSL_USER_NAME/.config/nginx/nginx.conf /etc/nginx/conf.d/nginx.conf

# Configure php.ini for FPM
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/fpm/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/fpm/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.3/fpm/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.3/fpm/php.ini
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.3/fpm/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/fpm/php.ini

printf "[openssl]\n" | tee -a /etc/php/8.3/fpm/php.ini
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
printf "[curl]\n" | tee -a /etc/php/8.3/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini

# Set The Nginx & PHP-FPM User
sed -i "s/user www-data;/user $WSL_USER_NAME;/" /etc/nginx/nginx.conf
sed -i "s/# server_names_hash_bucket_size.*/server_names_hash_bucket_size 64;/" /etc/nginx/nginx.conf

sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf

sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.3/fpm/pool.d/www.conf

# Disable XDebug On The CLI
sudo phpdismod -s cli xdebug
phpdismod -s cli xdebug

service nginx restart
service php8.3-fpm restart

# Add $WSL_USER_NAME User To WWW-Data
usermod -a -G www-data $WSL_USER_NAME
Expand All @@ -147,53 +109,11 @@ apt-get install -y sqlite3 libsqlite3-dev
service apparmor stop
update-rc.d -f apparmor remove

# Remove MySQL
apt-get remove -y --purge mysql-server mysql-client mysql-common
apt-get autoremove -y
apt-get autoclean

rm -rf /var/lib/mysql/*
rm -rf /var/log/mysql
rm -rf /etc/mysql

# Add Maria PPA
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

echo "mariadb-server mysql-server/data-dir select ''" | debconf-set-selections
echo "mariadb-server mysql-server/root_password password secret" | debconf-set-selections
echo "mariadb-server mysql-server/root_password_again password secret" | debconf-set-selections

mkdir /etc/mysql
touch /etc/mysql/debian.cnf

# Install MariaDB
apt-get install -y mariadb-server mariadb-client

# Configure Maria Remote Access and ignore db dirs
sed -i "s/bind-address = 127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/mariadb.conf.d/50-server.cnf
cat > /etc/mysql/mariadb.conf.d/50-server.cnf << EOF
[mysqld]
bind-address = 0.0.0.0
ignore-db-dir = lost+found
#general_log
#general_log_file=/var/log/mysql/mariadb.log
EOF

export MYSQL_PWD=secret

mysql --user="root" -e "GRANT ALL ON *.* TO root@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
service mysql restart

mysql --user="root" -e "CREATE USER IF NOT EXISTS 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret';"
mysql --user="root" -e "GRANT ALL ON *.* TO 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
mysql --user="root" -e "GRANT ALL ON *.* TO 'homestead'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
mysql --user="root" -e "FLUSH PRIVILEGES;"
service mysql restart

mysql_upgrade --user="root" --verbose --force
service mysql restart

unset MYSQL_PWD
bash 'scripts/features/mariadb.sh'

# Install Postgres 15
apt-get install -y postgresql-15 postgresql-server-dev-15 postgresql-15-postgis-3 postgresql-15-postgis-3-scripts
Expand All @@ -219,16 +139,14 @@ service redis-server start
apt-get upgrade -y

# Clean Up
apt -y autoremove
apt -y clean
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /usr/local/bin

# Add Composer Global Bin To Path
printf "\nPATH=\"$(sudo su - $WSL_USER_NAME -c 'composer config -g home 2>/dev/null')/vendor/bin:\$PATH\"\n" | tee -a /home/$WSL_USER_NAME/.profile

apt-get -y autoremove;
apt-get -y clean;
apt-get -y autoremove
apt-get -y clean

# What are you doing Ubuntu?
# https://askubuntu.com/questions/1250974/user-root-cant-write-to-file-in-tmp-owned-by-someone-else-in-20-04-but-can-in
Expand Down
5 changes: 4 additions & 1 deletion scripts/features/blackfire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ timeout=15s
"

echo "$agent" > "/etc/blackfire/agent"
echo "$client" > "/home/vagrant/.blackfire.ini"
echo "$client" > "/home/$WSL_USER_NAME/.blackfire.ini"

service php5.6-fpm restart
service php7.0-fpm restart
Expand All @@ -56,4 +56,7 @@ service php7.2-fpm restart
service php7.3-fpm restart
service php7.4-fpm restart
service php8.0-fpm restart
service php8.1-fpm restart
service php8.2-fpm restart
service php8.3-fpm restart
service blackfire-agent restart
3 changes: 3 additions & 0 deletions scripts/features/couchdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ sudo service php7.2-fpm restart
sudo service php7.3-fpm restart
sudo service php7.4-fpm restart
sudo service php8.0-fpm restart
sudo service php8.1-fpm restart
sudo service php8.2-fpm restart
sudo service php8.3-fpm restart
2 changes: 1 addition & 1 deletion scripts/features/crystal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ cd lucky_cli-0.11.0
shards install
crystal build src/lucky.cr --release --no-debug
mv lucky /usr/local/bin/.
cd /home/vagrant
cd /home/$WSL_USER_NAME
rm -rf lucky_cli-0.11.0
rm -rf v0.11.0.tar.gz
2 changes: 1 addition & 1 deletion scripts/features/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ else
fi

tar -C /usr/local -xzf golang.tar.gz go
printf "\nPATH=\"/usr/local/go/bin:\$PATH\"\n" | tee -a /home/vagrant/.profile
printf "\nPATH=\"/usr/local/go/bin:\$PATH\"\n" | tee -a /home/$WSL_USER_NAME/.profile
rm -rf golang.tar.gz
20 changes: 10 additions & 10 deletions scripts/features/ohmyzsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ touch /home/$WSL_USER_NAME/.homestead-features/oh-my-zsh
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install oh-my-zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git /home/vagrant/.oh-my-zsh
cp /home/vagrant/.oh-my-zsh/templates/zshrc.zsh-template /home/vagrant/.zshrc
git clone https://github.com/ohmyzsh/ohmyzsh.git /home/$WSL_USER_NAME/.oh-my-zsh
cp /home/$WSL_USER_NAME/.oh-my-zsh/templates/zshrc.zsh-template /home/$WSL_USER_NAME/.zshrc

# Set theme and plugins according to config
if [ -n "${theme}" ]; then
sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"${theme}\"/" /home/vagrant/.zshrc
sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"${theme}\"/" /home/$WSL_USER_NAME/.zshrc
fi
if [ -n "${plugins}" ]; then
sed -i "s/^plugins=.*/plugins=(${plugins})/" /home/vagrant/.zshrc
sed -i "s/^plugins=.*/plugins=(${plugins})/" /home/$WSL_USER_NAME/.zshrc
fi

printf "\nemulate sh -c 'source ~/.bash_aliases'\n" | tee -a /home/vagrant/.zprofile
printf "\nemulate sh -c 'source ~/.profile'\n" | tee -a /home/vagrant/.zprofile
chown -R vagrant:vagrant /home/vagrant/.oh-my-zsh
chown vagrant:vagrant /home/vagrant/.zshrc
chown vagrant:vagrant /home/vagrant/.zprofile
chsh -s /bin/zsh vagrant
printf "\nemulate sh -c 'source ~/.bash_aliases'\n" | tee -a /home/$WSL_USER_NAME/.zprofile
printf "\nemulate sh -c 'source ~/.profile'\n" | tee -a /home/$WSL_USER_NAME/.zprofile
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.oh-my-zsh
chown $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.zshrc
chown $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.zprofile
chsh -s /bin/zsh $WSL_USER_NAME
8 changes: 4 additions & 4 deletions scripts/features/php5.6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ printf "[curl]\n" | tee -a /etc/php/5.6/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/5.6/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/5.6/fpm/pool.d/www.conf

systemctl enable php5.6-fpm
Expand Down
8 changes: 4 additions & 4 deletions scripts/features/php7.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/7.0/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.0/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.0/fpm/pool.d/www.conf

systemctl enable php7.0-fpm
Expand Down
8 changes: 4 additions & 4 deletions scripts/features/php7.1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/7.1/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.1/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.1/fpm/pool.d/www.conf

systemctl enable php7.1-fpm
Expand Down
9 changes: 4 additions & 5 deletions scripts/features/php7.2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/7.2/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.2/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf

sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.2/fpm/pool.d/www.conf

systemctl enable php7.2-fpm
Expand Down
8 changes: 4 additions & 4 deletions scripts/features/php7.3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/7.3/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.3/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.3/fpm/pool.d/www.conf

systemctl enable php7.3-fpm
Expand Down
8 changes: 4 additions & 4 deletions scripts/features/php7.4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/7.4/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.4/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.4/fpm/pool.d/www.conf

systemctl enable php7.4-fpm
Expand Down
8 changes: 4 additions & 4 deletions scripts/features/php8.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/8.0/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.0/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.0/fpm/pool.d/www.conf

systemctl enable php8.0-fpm
Expand Down
18 changes: 9 additions & 9 deletions scripts/features/php8.1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/cli/php.ini

# Configure Xdebug
# echo "xdebug.mode = debug" >> /etc/php/8.1/mods-available/xdebug.ini
# echo "xdebug.discover_client_host = true" >> /etc/php/8.1/mods-available/xdebug.ini
# echo "xdebug.client_port = 9003" >> /etc/php/8.1/mods-available/xdebug.ini
# echo "xdebug.max_nesting_level = 512" >> /etc/php/8.1/mods-available/xdebug.ini
# echo "opcache.revalidate_freq = 0" >> /etc/php/8.1/mods-available/opcache.ini
echo "xdebug.mode = debug" >> /etc/php/8.1/mods-available/xdebug.ini
echo "xdebug.discover_client_host = true" >> /etc/php/8.1/mods-available/xdebug.ini
echo "xdebug.client_port = 9003" >> /etc/php/8.1/mods-available/xdebug.ini
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.1/mods-available/xdebug.ini
echo "opcache.revalidate_freq = 0" >> /etc/php/8.1/mods-available/opcache.ini

# Configure php.ini for FPM
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/fpm/php.ini
Expand All @@ -65,10 +65,10 @@ printf "[curl]\n" | tee -a /etc/php/8.1/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.1/fpm/pool.d/www.conf

systemctl enable php8.1-fpm
Expand Down
Loading

0 comments on commit f180742

Please sign in to comment.