Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
deb9:apache [2022/09/22 22:09] – [PHP Extensions] Bernard Condraudeb9:apache [2022/09/25 23:45] – [Xdebug] Bernard Condrau
Line 1: Line 1:
-====== Apache 2.4 and PHP 7/======+====== Apache 2.4 and PHP 5/======
 ===== Apache 2.4 Installation ===== ===== Apache 2.4 Installation =====
-  - Install apache 2.4<code>sudo apt update +  - Install apache 2.4<code>sudo apt update 
-sudo apt install apache2</code> +sudo apt install apache2</code> 
-  - Add one of the two commands to add the user to apache's user group:<code>sudo adduser <user> www-data +  - Add one of the two commands to add the user to apache's user group:<code>sudo adduser <user> www-data 
-sudo usermod -a -G www-data <user></code>+sudo usermod -a -G www-data <user></code> 
 +  - Setup your virtual hosts 
 +  - Create sub folders in ''/var/log/apache2'' if you setup log files for the virtual hosts in sub folders 
 +  - Install and configure [[deb11:certbot|Let's Encrypt Certbot]]
  
 ===== PHP Installation ===== ===== PHP Installation =====
-  - Install packages<code>sudo apt update +  - Install packages<code>sudo apt update 
-sudo apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https</code> +sudo apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https software-properties-common</code> 
-  - Add the SURY repository to your system<code>echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list +  - Add the SURY repository to your system<code>echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list</code> 
-sudo apt update</code> +  - Import the repository key<code>wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -</code> 
-  - Import the repository key<code>wget -q0 - https://packages.sury.org/php/apt.gpg | sudo apt-key add -</code> +  - Install the desired PHP version, where V is the major and v is the minor version number, for example 5.or 7.4<code>$ sudo apt update 
-  - Install the desired PHP version, where V is the major and v is the minor version number, for example 7.or 8.1<code>sudo apt install phpV.v</code> +sudo apt install phpV.v</code> 
-  - Enable modules:<code>sudo a2enmod ssl +  - Enable modules:<code>sudo a2enmod ssl 
-sudo a2enmod proxy +sudo a2enmod proxy 
-sudo a2enmod proxy_http</code>+sudo a2enmod proxy_http 
 +$ sudo a2enmod rewrite</code> 
 +  * [[https://computingforgeeks.com/how-to-install-latest-php-on-debian/|How To Install PHP 7.4 on Debian 10 / Debian 9]] 
 +  * [[https://www.php.net/supported-versions.php|Supported Versions]] 
 +  * [[https://github.com/oerdnj/deb.sury.org/issues/1575|Expired Debian key issue]]
  
 ===== PHP Extensions ===== ===== PHP Extensions =====
-  * PHP extensions for Joomla:<code>sudo apt install phpV.v-{bz2,curl,gd,mbstring,mysql,xml,zip} phpV.v-{bcmath}</code> +  * PHP extensions for Joomla:<code>sudo apt install phpV.v-{bz2,curl,gd,mbstring,mysql,xml,zip,json} phpV.v-{bcmath}</code> 
-  * PHP extensions for Wiki:<code>sudo apt install phpV.v-{bz2,curl,gd,mbstring,mysql,xml,zip} phpV.v-{sqlite3}</code> +  * PHP extensions for Wiki:<code>sudo apt install phpV.v-{bz2,curl,gd,mbstring,mysql,xml,zip,json} phpV.v-{sqlite3}</code> 
-  * Required for PHP7:<code>sudo apt install phpV.v-json</code> +  * Restart the service with one of the 2 commands below:<code>sudo /etc/init.d/apache2 restart</code>
-  * Restart the service with one of the 2 commands below:<code>sudo systemctl restart apache2 +
-sudo service apache2 restart</code>+
  
 ===== Set or change PHP version ===== ===== Set or change PHP version =====
Line 59: Line 64:
   - Copy the output from /var/www/html/php_info.txt   - Copy the output from /var/www/html/php_info.txt
   - Go to the [[https://xdebug.org/wizard|Xdebug: Installation Wizard]], and paste the output inside the text box on the page. It will analyze the output and will recommend the most suited package of Xdebug.   - Go to the [[https://xdebug.org/wizard|Xdebug: Installation Wizard]], and paste the output inside the text box on the page. It will analyze the output and will recommend the most suited package of Xdebug.
-  - Download that package, for example xdebug-3.1.5.tgz+  - Download that package, for example xdebug-2.8.4.tgz
   - Install the pre-requisites for compiling PHP extensions<code>sudo apt install phpV.v-dev autoconf automake</code>   - Install the pre-requisites for compiling PHP extensions<code>sudo apt install phpV.v-dev autoconf automake</code>
-  - Unpack the downloaded file with ''tar -xvzf xdebug-3.1.5.tgz'' within a temp folder, then change to that folder, run //phpize// and check it's output:<code>cd xdebug-3.1.5+  - Unpack the downloaded file with ''tar -xvzf xdebug-2.8.4.tgz'' within a temp folder, then change to that folder, run //phpize// and check it's output:<code>cd xdebug-2.8.4
 phpize phpize
 Configuring for: Configuring for:
 ... ...
-Zend Module Api No:      20190902 (7.4), 20200930 (8.0), 20210902 (8.1+Zend Module Api No:      20170718 (7.2), 20190902 (7.4
-Zend Extension Api No:   320190902 (7.4), 420200930 (8.0), 420210902 (8.1)</code>+Zend Extension Api No:   3220170718 (7.2), 320190902 (7.4)</code>
   - If it does not, you are using the wrong phpize. Please follow [[https://xdebug.org/docs/faq#custom-phpize|this FAQ entry]] and skip the next step.   - If it does not, you are using the wrong phpize. Please follow [[https://xdebug.org/docs/faq#custom-phpize|this FAQ entry]] and skip the next step.
   - Run:<code>./configure   - Run:<code>./configure
 make</code> make</code>
-  - Copy the module to:<code>sudo cp modules/xdebug.so /usr/lib/php/{20190902, 20200930, 20210902}</code> +  - Copy the module to:<code>sudo cp modules/xdebug.so /usr/lib/php/{20170718, 20190902}</code> 
-  - Xdebug 2: +  - Modify the configuration in /etc/php/{7.2, 7.4}/cli/php.ini for Xdebug 2:<file>zend_extension = /usr/lib/php/{20170718, 20190902}/xdebug.so
-    - Modify the configuration in /etc/php/7.4/cli/php.ini:<code>zend_extension = /usr/lib/php/20190902/xdebug.so+
 xdebug.remote_enable=1 xdebug.remote_enable=1
 xdebug.remote_port=9000 (default: 9000) xdebug.remote_port=9000 (default: 9000)
Line 78: Line 82:
 xdebug.profiler_enable_trigger=1 xdebug.profiler_enable_trigger=1
 xdebug.profiler_output_dir=PATH_TO_PROFILER_OUTPUT_DIR xdebug.profiler_output_dir=PATH_TO_PROFILER_OUTPUT_DIR
-xdebug.remote_log=PATH_TO_LOG/xdebug.log</code>+xdebug.remote_log=PATH_TO_LOG/xdebug.log</file>
     - Change the PATH_TO_PROFILER_OUTPUT_DIR to point to the directory you want to receive profiler output. change PATH_TO_LOG to point to the directory where you want to receive xdebug.log.     - Change the PATH_TO_PROFILER_OUTPUT_DIR to point to the directory you want to receive profiler output. change PATH_TO_LOG to point to the directory where you want to receive xdebug.log.
     - Make sure that zend_extension = /usr/lib/php/20190902/xdebug.so is below the line for OPcache. Please also update php.ini files in adjacent directories (//apache2// and //cli//), as your system might be configured with a separate php.ini file for the web server and command line.     - Make sure that zend_extension = /usr/lib/php/20190902/xdebug.so is below the line for OPcache. Please also update php.ini files in adjacent directories (//apache2// and //cli//), as your system might be configured with a separate php.ini file for the web server and command line.
-  - Xdebug 3: 
-    - Create ''/etc/php/8.0/apache2/conf.d/99-xdebug.ini'' and add lines:<code>zend_extension = xdebug 
-xdebug.remote_port=9000 (default: 9003) 
-xdebug.mode=debug</code> 
   - Restart your webserver.   - Restart your webserver.
   - Create a PHP page that has phpinfo(). Load it in a browser and look for the info on the Xdebug module. If you see it next to the Zend logo, you have been successful!   - Create a PHP page that has phpinfo(). Load it in a browser and look for the info on the Xdebug module. If you see it next to the Zend logo, you have been successful!
Line 90: Line 90:
  
 ===== phpMyAdmin ===== ===== phpMyAdmin =====
-Debian 10, other than Debian 9, requires manual installation of phpmyadmin, phpmyadmin has been removed from Debian's repositories.+Debian 10/11, other than Debian 9, require manual installation of phpmyadmin, phpmyadmin has been removed from Debian's repositories.
 ==== Installation ==== ==== Installation ====
   * Download [[https://www.phpmyadmin.net/downloads/|phpMyAdmin]] from the Downloads page, scroll down to the table with download links for the latest stable release, and copy the download link ending in tar.gz:<code>wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-english.tar.gz</code>   * Download [[https://www.phpmyadmin.net/downloads/|phpMyAdmin]] from the Downloads page, scroll down to the table with download links for the latest stable release, and copy the download link ending in tar.gz:<code>wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-english.tar.gz</code>
Line 162: Line 162:
 $ sudo service apache2 restart</code> $ sudo service apache2 restart</code>
  
-===== Let's Encrypt ===== 
-  * Secure all sites for your web server with SSL certificates:<code>sudo apt install python-certbot-apache</code> 
-  * If you have existing SSL VirtualHost definitions you need to copy a certificate from another site or webserver to /etc/letsencrypt/live and point the certificate in the virtual host file to that certificate before starting/restarting apache. This is necessary for certbot to run, and certbot will later replace the certificate with a valid one. 
-  * Run certbot and register sites:<code>certbot</code> 
-  * Check certificates:<code>certbot certificates</code> 
-  * Add domains to certificate:<code>certbot --expand -d example.com,www.example.com,click.example.com 
-certbot certonly --webroot --agree-tos -w /srv/www/letsencrypt/ --expand -d example.com,www.example.com,click.example.com</code> 
-  * Revoke and optionally delete certificate:<code>certbot revoke --cert-path /etc/letsencrypt/live/example.com/cert.pem</code> 
-  * Delete certificate:<code>certbot delete --cert-name www.example.com</code> 
-  * Delete listed domains:<code>certbot delete</code> 
-  * All sites must be accessible through port 80 when renewing certificates. 
  
 ==== Links ==== ==== Links ====