Ubuntu OS မွာ Apache ၿဖင္႔ PHP ကို Multiple Versions ေၿပာင္းလဲ အသံုးၿပဳၿခင္း

Ubuntu OS မွာ Apache ၿဖင္႔ PHP ကို Multiple Versions ေၿပာင္းလဲ အသံုးၿပဳၿခင္း
အကယ္၍ မိမိ development လုပ္ေနေသာ Environment မွာ PHP ကို Version တစ္မ်ဴိးထက္ပိုၿပီး Install လုပ္ထားရတယ္ ( eg. 5.6 and 7.3 )။ မိမိရဲ႕ Project ရဲ႕လုိအပ္ခ်က္အရ PHP ကို Version 5.6 နဲ႕ 7.3 Version ၂ မ်ဴိးလံုးအသံုးၿပဳဖုိ႕လိုအပ္ခဲ႕လွ်င္
——————————————————-
ဥပမာ အေနနဲ႕
Project1 – Yii Framework Version 1 – PHP 5.6
Project2 – Laravel Framework Version 5.7 – PHP 7.3
——————————————————-
How to change PHP Version for Apache
Enable php 5.6  and disable php 7.3
sudo a2dismod php7.3
sudo a2enmod php5.6
sudo service apache2 restart
Enable php 7.3  and Disable php 5.6
sudo a2dismod php5.6
sudo a2enmod php7.3
sudo service apache2 restart
/var/www/html folder ထဲတြင္ info.php ဆိုၿပီး PHP Script File တစ္ခုတည္ေဆာက္ၿပီး
<?php
phpinfo();
?>
ဆုိၿပီး သိမ္းဆည္းလိုက္ပါ။ ၿပီးလွ်င္ Browser မွ http://localhost/info.php ဆိုၿပီးေခၚၿကည္႔လုိက္ပါ။
မိမိရဲ႕ Apache Web Server ရဲ႕ လက္ရွိ PHP Version ကို ၿမင္ရပါလိမ္႔မယ္။
———————————————-
How to change PHP Version for Ubuntu ( command line usage )
Terminal ( Command Line ) တြင္
sudo update-alternatives –config php
PHP Version selection Questions ေပၚလာပါလိမ္႔မယ္။ မိမိ အလုိရွိေသာ PHP Version ကိုေရြးခ်ယ္ ေၿပာင္းလဲလုိ႕ရပါသည္။ ေၿပာင္းလဲၿပီးစီးသည္႔အခါ Teminal တြင္
php -v
ၿဖင္႔ PHP current version ကို ေခၚၿကည္ႏုိင္ပါသည္။
————————————————–
OS – Ubuntu – 16.04 / 18.04
Web Server – Apache
PHP – 5.6 & 7.3
—————————————————
Wai Yan Aung
20190921
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s