Install PHP 7.3 & Using PHP's Built-In Web Server
https://www.rosehosting.com/blog/how-to-install-php-7-3-on-ubuntu-16-04
video: https://www.youtube.com/watch?v=a0RK9rGvlzo
Step 3: Install Ondřej Surý’s PPA repository
We will use the Ondřej Surý’s PPA to install PHP 7.3 version, so install the software-properties-common and python-software-properties packages:
apt install software-properties-common python-software-properties
After the installation is complete, add the Ondřej PPA:
and then update your sources:
Step 4: Install PHP 7.3
We can install PHP 7.3 with the following command:
To check if PHP 7.3 is installed on your server, use the command below:
Output:
Step 5: Install specific PHP 7.3 extensions
If you want to install a specific module for PHP 7.3, you can search with this command:
Or, if you want to check all the PHP modules available in Ubuntu, run:
You can find the command below useful if you want to install the most frequently used PHP modules.
Step 6: Change the PHP version
In this step from our article, we will show you how you can change which version of PHP to be the default if you have multiple versions of PHP installed on your Ubuntu server.
To set PHP 7.0 as the default, run:
To set PHP 7.2 as the default, run:
To set PHP 7.3 as the default, run:
Before we can configure Apache to use PHP 7.3, we need to disable the old version of PHP 7.0 by typing:
Now enable the newly installed PHP 7.3 version with the following command:
Restart the Apache web server for the changes to take effect:
Step 7: Test and verify your PHP version
We can test the PHP version, Apache PHP and PHP modules with a simple PHP info file. We can create a phpinfo.php file in the web server default directory and access it with your server IP address on your favorite browser. In our example, we are using Apache web server so the default directory is located at /var/www/html/ .
Add the following code to it:
Open the ‘phpinfo.php’ file using a web browser:
You should be able to view the current information about PHP on your server.
Last updated