Skip to content

Commit d7ebbb5

Browse files
authored
12.x PHP 8.1 default (#235)
* Update motd handling * Update PHP block, Remove php-swoole as it's causing tons of 8.1 deps * Bump golang version * Update link PowerShell script
1 parent 9aeeefd commit d7ebbb5

File tree

4 files changed

+185
-124
lines changed

4 files changed

+185
-124
lines changed

bin/link-to-bento.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7
22
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
33

4-
New-Item -Path ..\bento\packer_templates\ubuntu\scripts\homestead.sh -ItemType SymbolicLink -Value .\scripts\provision.sh -Force
4+
New-Item -Path ..\bento\packer_templates\ubuntu\scripts\homestead.sh -ItemType SymbolicLink -Value .\scripts\arm.sh -Force
55
New-Item -Path ..\bento\packer_templates\ubuntu\http\preseed.cfg -ItemType SymbolicLink -Value .\http\preseed.cfg -Force
66
New-Item -Path ..\bento\packer_templates\ubuntu\http\preseed-hyperv.cfg -ItemType SymbolicLink -Value .\http\preseed-hyperv.cfg -Force
77

88
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace 'scripts/cleanup.sh','scripts/homestead.sh') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
99
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"memory": "1024"', '"memory": "2084"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
1010
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"disk_size": "65536"', '"disk_size": "131072"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
11-
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"boot_wait": "5s"', '"boot_wait": "10s"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
11+
# ((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"boot_wait": "5s"', '"boot_wait": "10s"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
1212
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"type": "hyperv-iso",', '"type": "hyperv-iso","configuration_version": "9.0",') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json

bin/link-to-bento.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
sed -i '' 's/scripts\/cleanup.sh/scripts\/homestead.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
99
sed -i '' 's/"cpus": "1"/"cpus": "2"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
10-
sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
10+
#sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
1111
sed -i '' 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
1212
sed -i '' 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
1313
sed -i '' '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
1414

1515
# Run for ARM
1616
sed -i '' 's/scripts\/cleanup.sh/scripts\/homestead-arm.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
17-
sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
17+
#sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
1818
sed -i '' 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
1919
sed -i '' 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
2020
sed -i '' '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json

scripts/amd64.sh

Lines changed: 90 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if "$SKIP_PHP"; then
7070
else
7171
# Install Generic PHP packages
7272
apt-get install -y --allow-change-held-packages \
73-
php-imagick php-memcached php-redis php-xdebug php-dev php-swoole imagemagick mcrypt
73+
php-imagick php-memcached php-redis php-xdebug php-dev imagemagick mcrypt
7474

7575
# PHP 5.6
7676
apt-get install -y --allow-change-held-packages \
@@ -326,47 +326,89 @@ else
326326
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
327327
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.4/fpm/pool.d/www.conf
328328

329-
## PHP 8.1
330-
#apt-get install -y --allow-change-held-packages \
331-
#php8.1 php8.1-bcmath php8.1-bz2 php8.1-cgi php8.1-cli php8.1-common php8.1-curl php8.1-dba php8.1-dev \
332-
#php8.1-enchant php8.1-fpm php8.1-gd php8.1-gmp php8.1-imap php8.1-interbase php8.1-intl php8.1-ldap \
333-
#php8.1-mbstring php8.1-mysql php8.1-odbc php8.1-opcache php8.1-pgsql php8.1-phpdbg php8.1-pspell php8.1-readline \
334-
#php8.1-snmp php8.1-soap php8.1-sqlite3 php8.1-sybase php8.1-tidy php8.1-xdebug php8.1-xml php8.1-xmlrpc php8.1-xsl \
335-
#php8.1-zip php8.1-memcached php8.1-redis
336-
#
337-
## Configure php.ini for CLI
338-
#sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/cli/php.ini
339-
#sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.1/cli/php.ini
340-
#sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/cli/php.ini
341-
#sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/cli/php.ini
342-
#
343-
## Configure Xdebug
344-
#echo "xdebug.mode = debug" >> /etc/php/8.1/mods-available/xdebug.ini
345-
#echo "xdebug.discover_client_host = true" >> /etc/php/8.1/mods-available/xdebug.ini
346-
#echo "xdebug.client_port = 9003" >> /etc/php/8.1/mods-available/xdebug.ini
347-
#echo "xdebug.max_nesting_level = 512" >> /etc/php/8.1/mods-available/xdebug.ini
348-
#echo "opcache.revalidate_freq = 0" >> /etc/php/8.1/mods-available/opcache.ini
349-
#
350-
## Configure php.ini for FPM
351-
#sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/fpm/php.ini
352-
#sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.1/fpm/php.ini
353-
#sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.1/fpm/php.ini
354-
#sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/fpm/php.ini
355-
#sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.1/fpm/php.ini
356-
#sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.1/fpm/php.ini
357-
#sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/fpm/php.ini
358-
#
359-
#printf "[openssl]\n" | tee -a /etc/php/8.1/fpm/php.ini
360-
#printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini
361-
#printf "[curl]\n" | tee -a /etc/php/8.1/fpm/php.ini
362-
#printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini
363-
#
364-
## Configure FPM
365-
#sed -i "s/user = www-data/user = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
366-
#sed -i "s/group = www-data/group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
367-
#sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
368-
#sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
369-
#sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.1/fpm/pool.d/www.conf
329+
# PHP 8.0
330+
apt-get install -y --allow-change-held-packages \
331+
php8.0 php8.0-bcmath php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-dba php8.0-dev \
332+
php8.0-enchant php8.0-fpm php8.0-gd php8.0-gmp php8.0-imap php8.0-interbase php8.0-intl php8.0-ldap \
333+
php8.0-mbstring php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pgsql php8.0-phpdbg php8.0-pspell php8.0-readline \
334+
php8.0-snmp php8.0-soap php8.0-sqlite3 php8.0-sybase php8.0-tidy php8.0-xdebug php8.0-xml php8.0-xmlrpc php8.0-xsl \
335+
php8.0-zip php8.0-memcached php8.0-redis
336+
337+
# Configure php.ini for CLI
338+
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.0/cli/php.ini
339+
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.0/cli/php.ini
340+
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.0/cli/php.ini
341+
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/cli/php.ini
342+
343+
# Configure Xdebug
344+
echo "xdebug.mode = debug" >> /etc/php/8.0/mods-available/xdebug.ini
345+
echo "xdebug.discover_client_host = true" >> /etc/php/8.0/mods-available/xdebug.ini
346+
echo "xdebug.client_port = 9003" >> /etc/php/8.0/mods-available/xdebug.ini
347+
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.0/mods-available/xdebug.ini
348+
echo "opcache.revalidate_freq = 0" >> /etc/php/8.0/mods-available/opcache.ini
349+
350+
# Configure php.ini for FPM
351+
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.0/fpm/php.ini
352+
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.0/fpm/php.ini
353+
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.0/fpm/php.ini
354+
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.0/fpm/php.ini
355+
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.0/fpm/php.ini
356+
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.0/fpm/php.ini
357+
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/fpm/php.ini
358+
359+
printf "[openssl]\n" | tee -a /etc/php/8.0/fpm/php.ini
360+
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.0/fpm/php.ini
361+
printf "[curl]\n" | tee -a /etc/php/8.0/fpm/php.ini
362+
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.0/fpm/php.ini
363+
364+
# Configure FPM
365+
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
366+
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
367+
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
368+
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
369+
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.0/fpm/pool.d/www.conf
370+
371+
# PHP 8.1
372+
apt-get install -y --allow-change-held-packages \
373+
php8.1 php8.1-bcmath php8.1-bz2 php8.1-cgi php8.1-cli php8.1-common php8.1-curl php8.1-dba php8.1-dev \
374+
php8.1-enchant php8.1-fpm php8.1-gd php8.1-gmp php8.1-imap php8.1-interbase php8.1-intl php8.1-ldap \
375+
php8.1-mbstring php8.1-mysql php8.1-odbc php8.1-opcache php8.1-pgsql php8.1-phpdbg php8.1-pspell php8.1-readline \
376+
php8.1-snmp php8.1-soap php8.1-sqlite3 php8.1-sybase php8.1-tidy php8.1-xdebug php8.1-xml php8.1-xmlrpc php8.1-xsl \
377+
php8.1-zip php8.1-memcached php8.1-redis
378+
379+
# Configure php.ini for CLI
380+
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/cli/php.ini
381+
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.1/cli/php.ini
382+
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/cli/php.ini
383+
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/cli/php.ini
384+
385+
# Configure Xdebug
386+
echo "xdebug.mode = debug" >> /etc/php/8.1/mods-available/xdebug.ini
387+
echo "xdebug.discover_client_host = true" >> /etc/php/8.1/mods-available/xdebug.ini
388+
echo "xdebug.client_port = 9003" >> /etc/php/8.1/mods-available/xdebug.ini
389+
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.1/mods-available/xdebug.ini
390+
echo "opcache.revalidate_freq = 0" >> /etc/php/8.1/mods-available/opcache.ini
391+
392+
# Configure php.ini for FPM
393+
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/fpm/php.ini
394+
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.1/fpm/php.ini
395+
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.1/fpm/php.ini
396+
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/fpm/php.ini
397+
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.1/fpm/php.ini
398+
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.1/fpm/php.ini
399+
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/fpm/php.ini
400+
401+
printf "[openssl]\n" | tee -a /etc/php/8.1/fpm/php.ini
402+
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini
403+
printf "[curl]\n" | tee -a /etc/php/8.1/fpm/php.ini
404+
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini
405+
406+
# Configure FPM
407+
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
408+
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
409+
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
410+
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
411+
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.1/fpm/pool.d/www.conf
370412

371413
# Disable old PHP FPM
372414
systemctl disable php5.6-fpm
@@ -375,18 +417,11 @@ else
375417
systemctl disable php7.2-fpm
376418
systemctl disable php7.3-fpm
377419
systemctl disable php7.4-fpm
420+
systemctl disable php8.0-fpm
378421

379-
# PHP 8.0
380-
apt-get install -y --allow-change-held-packages \
381-
php8.0 php8.0-bcmath php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-dba php8.0-dev \
382-
php8.0-enchant php8.0-fpm php8.0-gd php8.0-gmp php8.0-imap php8.0-interbase php8.0-intl php8.0-ldap \
383-
php8.0-mbstring php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pgsql php8.0-phpdbg php8.0-pspell php8.0-readline \
384-
php8.0-snmp php8.0-soap php8.0-sqlite3 php8.0-sybase php8.0-tidy php8.0-xdebug php8.0-xml php8.0-xsl php8.0-zip \
385-
php8.0-memcached
386-
387-
update-alternatives --set php /usr/bin/php8.0
388-
update-alternatives --set php-config /usr/bin/php-config8.0
389-
update-alternatives --set phpize /usr/bin/phpize8.0
422+
update-alternatives --set php /usr/bin/php8.1
423+
update-alternatives --set php-config /usr/bin/php-config8.1
424+
update-alternatives --set phpize /usr/bin/phpize8.1
390425

391426
# Install Composer
392427
curl -sS https://getcomposer.org/installer | php
@@ -402,12 +437,6 @@ else
402437
/usr/local/bin/composer global require tightenco/takeout
403438
EOF
404439

405-
# Set Some PHP CLI Settings
406-
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.0/cli/php.ini
407-
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.0/cli/php.ini
408-
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.0/cli/php.ini
409-
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/cli/php.ini
410-
411440
# Install Apache
412441
apt-get install -y apache2 libapache2-mod-fcgid
413442
sed -i "s/www-data/vagrant/" /etc/apache2/envvars
@@ -657,7 +686,6 @@ ExecStart=/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
657686
[Install]
658687
WantedBy=multi-user.target
659688
EOL
660-
fi
661689

662690
sudo systemctl daemon-reload
663691
sudo systemctl enable mailhog
@@ -682,6 +710,8 @@ sed -i "s/relayhost =/relayhost = [localhost]:1025/g" /etc/postfix/main.cf
682710
# Update / Override motd
683711
echo "export ENABLED=1"| tee -a /etc/default/motd-news
684712
sed -i "s/motd.ubuntu.com/homestead.joeferguson.me/g" /etc/update-motd.d/50-motd-news
713+
sed -i "s/motd.ubuntu.com/homestead.joeferguson.me/g" /etc/default/motd-news
714+
rm -rf /var/cache/motd-news
685715
rm -rf /etc/update-motd.d/10-help-text
686716
rm -rf /etc/update-motd.d/50-landscape-sysinfo
687717
rm -rf /etc/update-motd.d/99-bento

0 commit comments

Comments
 (0)