A few months I upgraded php to 7.2. Recently an upgrade to 7.2.9 caused a crash (segmentation fault) on my apache server, likely an updagraded module memory issue. So today I decided to upgrade to 7.3 to see if this resolves the issue.
I had to install the following packages too,
sudo apt install php7.3 php7.3-bz2 php7.3-common php7.3-curl php7.3-imap php7.3-json php7.3-opcache php7.3-phpdbg php7.3-pspell php7.3-snmp php7.3-sqlite3 php7.3-xmlrpc php7.3-xsl php7.3-zip php7.3-mbstring php7.3-mysql php7.3-gd
In case you need to install apache2…
sudo apt install apache2
Once installed, make sure it is working, open a browser page with the http://localhost url to see the apache default response page.
MySQL is now MariaDB in debian 9. For more information see this detailed migration page,
sudo apt install mariadb-server
configure a password for the admin root DB user,
sudo mysql_secure_installation
follow the online instructions, they rather straighfwd and you can answer Y to most of them (for hardening of the DB, or ‘n’ in the case where you are using this as a development machine. Setting up the MariaDB admin root password using the sudo command only allows access to the db from a root shell, and therefore is not accessible from phpmyadmin. To chnage this you need to log into the the mysql tool,
sudo mysql -u root -p
enter the password you setup for root, and execute the following command,
GRANT ALL PRIVILEGES on *.* to 'root'@'localhost' IDENTIFIED BY '<password>';
where <passwprd>
is the password your setup, followed by,
FLUSH PRIVILEGES;
exit
switch apache to use php7.3,
a2enmod php7.3
install the phpmyadmin package to manage the DB from the browser,
sudo apt install phpmyadmin
restart apache to pickup all the changes,
sudo service apache2 restart
Some bookkeeping,
The default web folder is /var/www/html, and I recommend you use it for development as well by changing the default folder owner to www-data which is the account apache runs under,
sudo chown -R www-data:www-data /var/www/.
this changes the owner and group of the folder from ‘root’ to ‘www-data’
sudo usermod -a -G www-data <your username>
next add your username (the name of your home folder), into the ‘www-data’ group. You’ll need to login/logout for your username to reflect the permission changes.
sudo chmod -R 775 /var/www/.
and finally allow those in the ‘www-data’ group to access the folder as well.
NOTE: I found through experience that it is easier to add your own user to the www-data group and configure the ownership as your own but the group www-data,
chown :www-data -R *
You can also ensure that all files created are assigned to the www-data group with the same permissions (this saves having to reset them when installing new instances of wordpress files),
chmod g+rwxs /var/www/html
sudo setfacl -d -m g::rwx /var/www/html
sudo setfacl -d -m o::rx /var/www/html
Enabling directive override and rewrite module
This is important if you are going to use htaccess rewrites such as with WordPress. To do this, you need to first enable the rewrite module,
sudo a2enmod rewrite
next you need to allow the override directive for all in your apache2.conf file, edit it using
sudo nano /etc/apache2/apache2.conf
and find the line with your Directory settings and change the ‘AllowOverride’ directive to ‘All’,
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
as well as for your default folder,
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
make sure you restart the apache service.