diff --git a/bin/wsl-init b/bin/wsl-init index 329101c71..227b37cc8 100644 --- a/bin/wsl-init +++ b/bin/wsl-init @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/scripts/features/blackfire.sh b/scripts/features/blackfire.sh index f60f9139f..c157fe46b 100755 --- a/scripts/features/blackfire.sh +++ b/scripts/features/blackfire.sh @@ -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 @@ -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 diff --git a/scripts/features/couchdb.sh b/scripts/features/couchdb.sh index f6e92da1b..875efb6e0 100755 --- a/scripts/features/couchdb.sh +++ b/scripts/features/couchdb.sh @@ -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 \ No newline at end of file diff --git a/scripts/features/crystal.sh b/scripts/features/crystal.sh index ed5521c7a..289422ac5 100755 --- a/scripts/features/crystal.sh +++ b/scripts/features/crystal.sh @@ -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 diff --git a/scripts/features/golang.sh b/scripts/features/golang.sh index bda962d2e..032bae6be 100755 --- a/scripts/features/golang.sh +++ b/scripts/features/golang.sh @@ -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 diff --git a/scripts/features/ohmyzsh.sh b/scripts/features/ohmyzsh.sh index 2a02f47ba..1bd20171a 100755 --- a/scripts/features/ohmyzsh.sh +++ b/scripts/features/ohmyzsh.sh @@ -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 diff --git a/scripts/features/php5.6.sh b/scripts/features/php5.6.sh index ff91b2f13..333f0f532 100644 --- a/scripts/features/php5.6.sh +++ b/scripts/features/php5.6.sh @@ -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 diff --git a/scripts/features/php7.0.sh b/scripts/features/php7.0.sh index f168bc0de..14f467954 100644 --- a/scripts/features/php7.0.sh +++ b/scripts/features/php7.0.sh @@ -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 diff --git a/scripts/features/php7.1.sh b/scripts/features/php7.1.sh index d03f979ab..f1f58135f 100644 --- a/scripts/features/php7.1.sh +++ b/scripts/features/php7.1.sh @@ -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 diff --git a/scripts/features/php7.2.sh b/scripts/features/php7.2.sh index 86193c20b..73750dc7b 100644 --- a/scripts/features/php7.2.sh +++ b/scripts/features/php7.2.sh @@ -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 diff --git a/scripts/features/php7.3.sh b/scripts/features/php7.3.sh index bf98e10db..5af04446d 100644 --- a/scripts/features/php7.3.sh +++ b/scripts/features/php7.3.sh @@ -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 diff --git a/scripts/features/php7.4.sh b/scripts/features/php7.4.sh index 4dc69401c..f76bec1b1 100644 --- a/scripts/features/php7.4.sh +++ b/scripts/features/php7.4.sh @@ -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 diff --git a/scripts/features/php8.0.sh b/scripts/features/php8.0.sh index 9025a6301..4491819c0 100644 --- a/scripts/features/php8.0.sh +++ b/scripts/features/php8.0.sh @@ -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 diff --git a/scripts/features/php8.1.sh b/scripts/features/php8.1.sh index 4bc038c31..f6c6940b3 100644 --- a/scripts/features/php8.1.sh +++ b/scripts/features/php8.1.sh @@ -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 @@ -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 diff --git a/scripts/features/php8.2.sh b/scripts/features/php8.2.sh index 3d09ef7a9..4390cb48f 100644 --- a/scripts/features/php8.2.sh +++ b/scripts/features/php8.2.sh @@ -63,10 +63,10 @@ printf "[curl]\n" | tee -a /etc/php/8.2/fpm/php.ini printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.2/fpm/php.ini # Configure FPM -sed -i "s/user = www-data/user = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf -sed -i "s/group = www-data/group = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf -sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf -sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf +sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/8.2/fpm/pool.d/www.conf +sed -i "s/group = www-data/group = $WSL_USER_GROUP/" /etc/php/8.2/fpm/pool.d/www.conf +sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/8.2/fpm/pool.d/www.conf +sed -i "s/listen\.group.*/listen.group = $WSL_USER_GROUP/" /etc/php/8.2/fpm/pool.d/www.conf sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.2/fpm/pool.d/www.conf systemctl enable php8.2-fpm diff --git a/scripts/features/php8.3.sh b/scripts/features/php8.3.sh index 6171232aa..7dd2655e7 100644 --- a/scripts/features/php8.3.sh +++ b/scripts/features/php8.3.sh @@ -10,6 +10,14 @@ fi export DEBIAN_FRONTEND=noninteractive +SERVICE_STATUS=$(systemctl is-enabled php8.3-fpm.service) + +if [ "$SERVICE_STATUS" == "disabled" ]; +then + systemctl enable php8.3-fpm + service php8.3-fpm restart +fi + if [ -f /home/$WSL_USER_NAME/.homestead-features/php83 ] then echo "PHP 8.3 already installed." @@ -55,8 +63,11 @@ 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 # Configure FPM -sed -i "s/user = www-data/user = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf -sed -i "s/group = www-data/group = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf -sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf -sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.3/fpm/pool.d/www.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_GROUP/" /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_GROUP/" /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 + +systemctl enable php8.3-fpm +service php8.3-fpm restart \ No newline at end of file diff --git a/scripts/features/python.sh b/scripts/features/python.sh index cb88cb812..4555f06c3 100755 --- a/scripts/features/python.sh +++ b/scripts/features/python.sh @@ -22,6 +22,6 @@ chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-feature # Install Python apt-get update apt-get install -y python3-pip build-essential libssl-dev libffi-dev python3-dev python3-venv -sudo -H -u vagrant bash -c 'pip3 install django' -sudo -H -u vagrant bash -c 'pip3 install numpy' -sudo -H -u vagrant bash -c 'pip3 install masonite' +sudo -H -u $WSL_USER_NAME bash -c 'pip3 install django' +sudo -H -u $WSL_USER_NAME bash -c 'pip3 install numpy' +sudo -H -u $WSL_USER_NAME bash -c 'pip3 install masonite' diff --git a/src/WslCreateDatabaseCommand.php b/src/WslCreateDatabaseCommand.php index 4448ef02e..59b094fbc 100644 --- a/src/WslCreateDatabaseCommand.php +++ b/src/WslCreateDatabaseCommand.php @@ -68,7 +68,7 @@ public function execute(InputInterface $input, OutputInterface $output) foreach ($settings['databases'] as $db) { $create_cmd = ''; $query = "CREATE DATABASE IF NOT EXISTS {$db} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci"; - $create_cmd = 'mysql -u homestead -psecret -e "'.$query.'"'; + $create_cmd = 'mariadb -u homestead -psecret -e "'.$query.'"'; // run command to create the database $shell_output = shell_exec($create_cmd); if (! is_null($shell_output)) { diff --git a/src/WslCreateSiteCommand.php b/src/WslCreateSiteCommand.php index 7bb2420c9..397737786 100644 --- a/src/WslCreateSiteCommand.php +++ b/src/WslCreateSiteCommand.php @@ -117,13 +117,14 @@ public function execute(InputInterface $input, OutputInterface $output) if (! is_null($shell_output)) { var_dump($shell_output); } + } - // Restart nginx - $shell_output = shell_exec('sudo service nginx restart'); - if (! is_null($shell_output)) { - var_dump($shell_output); - } + // Restart nginx + $shell_output = shell_exec('sudo service nginx restart'); + if (! is_null($shell_output)) { + var_dump($shell_output); } + $output->writeln('WSL sites have been created!'); return 0;