#!/bin/bash ######系統配合 #下載ISO檔 #https://ftp.ubuntu-tw.org/ubuntu-releases/26.04.1/ 安裝 ######鄭亮星 jls@mail.jls.idv.tw , jls550225@gmail.com , jls@acfs.tw ##安裝 php_mysql & tonyenc for php 7.4 wget -O /usr/share/key/php.gpg https://packages.sury.org/php/apt.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list apt -y modernize-sources apt -y update #### PHP 7.4 apt -y install php7.4 php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-gd php7.4-igbinary php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-odbc php7.4-opcache php7.4-readline php7.4-redis php7.4-snmp php7.4-sqlite3 php7.4-xml php7.4-zip php7.4-fpm libapache2-mod-php7.4 php7.4-bcmath php7.4-cgi php7.4-bz2 php7.4-gmp php7.4-intl php7.4-pgsql php7.4-soap find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"error_reporting = E_ALL & ~E_DEPRECATED"/"error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT"/g {} \; find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"post_max_size = 8M"/"post_max_size = 500M"/g {} \; find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"upload_max_filesize = 2M"/"upload_max_filesize = 500M"/g {} \; #find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"session.auto_start = 0"/"session.auto_start = 1"/g {} \; find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"short_open_tag = Off"/"short_open_tag = On"/g {} \; find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/";date.timezone ="/"date.timezone = Asia\/Taipei"/g {} \; #find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"magic_quotes_gpc = Off"/"magic_quotes_gpc = On"/g {} \; find /etc/php/7.4/apache2/php.ini -type f -exec perl -i -pe s/"memory_limit = 128M"/"memory_limit = 1024M"/g {} \; find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"error_reporting = E_ALL & ~E_DEPRECATED"/"error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT"/g {} \; find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"post_max_size = 8M"/"post_max_size = 500M"/g {} \; find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"upload_max_filesize = 2M"/"upload_max_filesize = 500M"/g {} \; #find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"session.auto_start = 0"/"session.auto_start = 1"/g {} \; find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"short_open_tag = Off"/"short_open_tag = On"/g {} \; find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/";date.timezone ="/"date.timezone = Asia\/Taipei"/g {} \; #find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"magic_quotes_gpc = Off"/"magic_quotes_gpc = On"/g {} \; find /etc/php/7.4/fpm/php.ini -type f -exec perl -i -pe s/"memory_limit = 128M"/"memory_limit = 1024M"/g {} \; #### PHP8.6 apt -y install php8.6 php8.6-cli php8.6-common php8.6-curl php8.6-dev php8.6-gd php8.6-ldap php8.6-mbstring php8.6-mysql php8.6-odbc php8.6-readline php8.6-snmp php8.6-sqlite3 php8.6-xml php8.6-zip php8.6-fpm libapache2-mod-php8.6 php8.6-bcmath php8.6-cgi php8.6-bz2 php8.6-gmp php8.6-intl php8.6-pgsql php8.6-soap find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"error_reporting = E_ALL & ~E_DEPRECATED"/"error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT"/g {} \; find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"post_max_size = 8M"/"post_max_size = 500M"/g {} \; find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"upload_max_filesize = 2M"/"upload_max_filesize = 500M"/g {} \; #find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"session.auto_start = 0"/"session.auto_start = 1"/g {} \; find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"short_open_tag = Off"/"short_open_tag = On"/g {} \; find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/";date.timezone ="/"date.timezone = Asia\/Taipei"/g {} \; #find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"magic_quotes_gpc = Off"/"magic_quotes_gpc = On"/g {} \; find /etc/php/8.6/apache2/php.ini -type f -exec perl -i -pe s/"memory_limit = 128M"/"memory_limit = 1024M"/g {} \; find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"error_reporting = E_ALL & ~E_DEPRECATED"/"error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT"/g {} \; find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"post_max_size = 8M"/"post_max_size = 500M"/g {} \; find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"upload_max_filesize = 2M"/"upload_max_filesize = 500M"/g {} \; #find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"session.auto_start = 0"/"session.auto_start = 1"/g {} \; find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"short_open_tag = Off"/"short_open_tag = On"/g {} \; find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/";date.timezone ="/"date.timezone = Asia\/Taipei"/g {} \; #find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"magic_quotes_gpc = Off"/"magic_quotes_gpc = On"/g {} \; find /etc/php/8.6/fpm/php.ini -type f -exec perl -i -pe s/"memory_limit = 128M"/"memory_limit = 1024M"/g {} \; tar zxvf mysql7.4.tgz cd mysql7.4 /usr/bin/phpize7.4 ./configure --with-php-config=/usr/bin/php-config7.4 make make install cat > /etc/php/7.4/mods-available/mysql.ini << EOF # Enable mysql extension module extension=mysql.so EOF cd .. tar zxvf mysql8.x.tgz cd mysql8.x /usr/bin/phpize8.6 ./configure CFLAGS="-Wno-implicit-function-declaration" --with-php-config=/usr/bin/php-config8.6 make make install cat > /etc/php/8.6/mods-available/mysql.ini << EOF # Enable mysql extension module extension=mysql.so EOF cd .. tar zxvf tonyenc7.x.tgz cd tonyenc7.x /usr/bin/phpize7.4 ./configure --with-php-config=/usr/bin/php-config7.4 make make install cat > /etc/php/7.4/mods-available/tonyenc.ini << EOF # Enable tonyenc extension module extension=tonyenc.so EOF cd .. tar zxvf tonyenc8.x.tgz cd tonyenc8.x /usr/bin/phpize8.6 ./configure --with-php-config=/usr/bin/php-config8.6 make make install cat > /etc/php/8.6/mods-available/tonyenc.ini << EOF # Enable tonyenc extension module extension=tonyenc.so EOF phpenmod mysql phpenmod tonyenc a2enmod actions proxy_fcgi systemctl restart named.service systemctl restart php7.4-fpm.service systemctl restart apache2.service