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.
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.
php中文网 Courses
php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.