Build and Install PHP 8.0 for Ubuntu 18.04
This is an annex to this article: https://computingforgeeks.com/install-php-8-7-on-ubuntu-18-bionic-beaver/?expand_article=1
The article is a guide on how to install PHP 8.0 on Ubuntu 18.04 a Linux distribution.
The following is a modification of the source material so you can make the installation ready for a wordpress website on apache2.
# Installing dependency packages
|
|
|
|
if libzip4 dependencies unmet error do:
|
|
|
|
this removes the faulty repo, then purge the libzip4 installed previously (this may break other wordpress/php installations on your system)
|
|
|
|
then run again
|
|
# ./configure command
I modified the command to use the correct modules and features from php to run a wordpress server with apache2 on an Ubuntu 18.04 based distro.
|
|
# Sample output
|
|
If it throws a warning, its probably because some of these are already enabled by default in recent PHP versions.
Note !!! Remember to do phpenmod zip
for example for any modules not active by default.
# Command Explanation
Explanation of some key options:
--prefix
: Specifies the installation directory for PHP.--with-apxs2
: Points to the Apacheapxs2
tool for building PHP as an Apache module.--with-config-file-path
: Specifies the path to the PHP configuration file used by Apache.--enable-fpm
: Enables PHP-FPM.--with-fpm-user
and--with-fpm-group
: Specifies the user and group for PHP-FPM.--with-mysqli
and--with-pdo-mysql
: Enable MySQL support for PHP.--with-openssl
: Enables OpenSSL support.--with-curl
: Enables cURL support for remote data fetching.--with-zlib
: Enables zlib compression support.--with-gd
,--with-jpeg
,--with-freetype
: Enables GD image library support.--with-xmlrpc
: Enables XML-RPC support.--with-iconv
: Enables iconv support for character encoding conversion.--enable-bcmath
,--enable-mbstring
,--enable-gd
,--enable-zip
,--enable-xml
,--enable-json
,--enable-exif
,--enable-intl
,--enable-opcache
,--enable-sockets
,--enable-soap
: Enable various PHP extensions commonly used by WordPress.--disable-cgi
: Disables CGI mode.
Please note that this list is a general guideline, and your specific requirements might vary based on your WordPress theme, plugins, and server setup. Always refer to the official PHP documentation and test thoroughly after making changes.
# Final Thoughts
After this you can resume the guide at the beginning, just have in mind our installation path is different, for example instead of doing
|
|
we do
|
|
Also have in mind you might want to remove the old php installation like this
|
|
For my case use, my php-fpm config files are in
|
|
And I’m using Apache2.
# Source for the commands and explanation:
Chat GPT-3.5 https://www.php.net/manual/en/install.unix.apache2.php
Other sources, read https://www.gulshankumar.net/install-wordpress-with-lamp/