How to Change the Default PHP Version from 5.6 to 7.3 on a Linux Server

This guide explains how to replace the default PHP 5.6 with PHP 7.3 on a Linux server by editing the system profile, updating the PATH variable, and reloading the profile, including the necessary command-line steps and code snippets.

php Courses
php Courses
php Courses
How to Change the Default PHP Version from 5.6 to 7.3 on a Linux Server

The article shows how to upgrade the default PHP interpreter from version 5.6 to 7.3 on a Linux environment. It starts by displaying the current PHP version (via a screenshot) and then proceeds with the required configuration changes.

First, open the system profile file for editing: cd /etc && vim /etc/profile Enter insert mode by pressing i, scroll to the bottom of the file, and add the following line to prepend the new PHP binary directory to the PATH: export PATH=/www/server/php/73/bin:$PATH Exit insert mode by pressing Esc, then save and quit with :wq!. Finally, apply the changes to the current session: source /etc/profile After sourcing the profile, the new PHP version becomes active; you can verify it with php -v (the verification step is shown in an accompanying screenshot). The article ends with a link to the original source for further reference.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendLinuxPHPVersion UpgradeTutorial
php Courses
Written by

php Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.