How to upgrade the php version to php7.4 in VestaCP or Vesta on Ubuntu.
VestaCP or vesta is the most recommended, free, and open-source hosting application. Till this post, it uses a 7.2 version of PHP. In this post, I will install or upgrade php7.4 in vesta.
First, let’s check the current PHP version.
# php -v
The output of the command will be looks like this.

The second method to verify the PHP version is, create a phpinfo.php file in the root directory and add this line without quote “<?php phpinfo(); ?>“. Restart the apache2 service and refresh or browse the web page. Your URL will be http://example.com or IP_address/pfpinfo.php

We have tested and verified the PHP version. The current version is 7.2
Let’s install and configure the php7.4 on the vesta.
Install software common properties and PHP pap repository.
# apt install software-common-properties
# add-apt-repository ppa:ondrej/php
After installing the software common properties and php ppa repository. Install the php7.4 and common extensions.
# apt install php7.4
# apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl
PHP 7.4 is installed successfully. Let’s check again the PHP version from both methods. Running PHP -v command and refreshing or browsing the website. php -v command shows that the PHP version is upgraded to the 7.4 but the website or vesta does not acknowledge the up-gradation of PHP. It is still using php7.2.
Because of apache still bind to the php7.2. To fix this issue, we need to disable php7.2 and enable php7.4 with apache2. And restart the apache2 service.
# a2dismod php7.2
# a2enmod php7.4
# systemctl restart apache2
Now, Apache2 binds with php7.4, and vesta also working fine with it.

Yes, we successfully upgrade to the php7.4. Now we can remove the php7.2 from the system and make sure that everything is working fine.
# apt remove php7.2*
# apt autoremove
Reboot your system. Everything should be fine now.
If you missed some common extensions of php7.4, the issue will be unable to access PHPMyAdmin and Roundcube email. Install those extensions and reboot the whole vesta system, or restart the php-fpm, Apache2, and vesta service. The link below is the troubleshooting of Roundcube if there is any database-related issue after upgrading to php7.4.
Fix roundcube database-related issue
If you have any questions regarding this topic, please leave the comment below.
Way cool! Some extremely valid points! I appreciate you writing this write-up plus the rest of the site is also very good.
Thanks for finally talking about > Upgrade PHP version to
7.4 in vestacp - BoredAdmin < Liked it!
Its not my first time to pay a quick visit this
web page, i am browsing this website dailly and get good
information from here every day.
Keep this going please, great job!
I like what you guys are usually up too. This type of clever work
and exposure! Keep up the superb works guys I’ve added you guys to
my blogroll.
It’s really a cool and helpful piece of information. I’m happy that
you just shared this helpful info with us. Please keep us up to date like this.
Thanks for sharing.
I absolutely love your blog.. Pleasant colors & theme. Did you make this website yourself?
Please reply back as I’m trying to create my own personal website and want to find out where you got this from or what the theme
is named. Many thanks!
you’re truly a excellent webmaster. The website
loading speed is incredible. It kind of feels that
you are doing any distinctive trick. In addition,
The contents are masterwork. you have done a great task on this topic!
While these tricks are easy to into your regular conversation routine, correctly practiced
often. Bring the fear right down to the tiny thing
around the globe. or, again, pick a different emotion altogether.
Thanks for this great tutorial. I was able to successfully upgrade from php7.2 to php7.4.
I have one question though, I’m hoping someone can help answer.
After I installed php7.4 and enabled it on apache. “php -v” showed that I had php7.4 installed. However, after I run the command “apt remove php7.2*”, the installer will remove php7.2 and then automatically install php8.0. When I check with “php -v” after I run the apt remove command, it shows that php8.0 has been installed.
Why does this happen and how to avoid it? And does it matter? It seems that since I did not enable it, php7.4 is still running and shows when I do a phpinfo(); command in a php file, but I’m just concerned that php8.0 has been installed and may break something else.
Any help would be appreciated!
Thanks for the tutorial, noticed one quick fix:
# systemctl restart apoache2
should read:
# systemctl restart apache2
This is great loved it
What a bullshitted how-to.
You need to purge php, not only remove.
there is a typo, it’s systemctl restart apache2 not systemctl restart apoache2
Very nice tutorial, everything worked great. I just want to include that there is spelling error in the command to restart apache. Thank you so much
# a2dismod php7.2
# a2enmod php7.4
# systemctl restart apoache2
please correct the wording to apache2
A fascinating discussion is worth comment. I believe that you need to
publish more about this subject, it might not be
a taboo matter but typically folks don’t talk about such subjects.
To the next! Kind regards!!
Greate pieces. Keep posting such kind of info on your page.
Im really impressed by it.
Hello there, You’ve done an excellent job. I’ll definitely digg it and
for my part suggest to my friends. I’m confident they will be benefited
from this website.
Hі! I know this is somewhat off topic but I was wondering if you
knew where I could locate a captchа рlugin for my comment form?
I’m using the same ƅlog platform as уours and I’m
having problеmѕ finding one? Thanks a lot!
Here іs my web bⅼog – buy injectable steroids
Generally I dߋn’t read poѕt on blogs, howеver I wish to say
that tһis write-up very prеssured me to ϲhecҝ оut and do
it! Your wгiting styⅼe has been surprised me.
Thanks, very nice post.
Thanks , I have recently been searching for information approximately this topic for ages and yours
is the best I have discovered till now. But, what about the conclusion? Are you positive in regards to the supply?
Have you ever thought about adding a little bit more than just your
articles? I mean, what you say is fundamental and everything.
But think of if you added some great pictures or videos to give your posts more, “pop”!
Your content is excellent but with images and
clips, this website could definitely be one of the very best in its
niche. Awesome blog!
It’s really amazing finally I was able to upgrade my PHP in Vestacp. Love you, bro!
This is a very good tip especially to those new to the blogosphere.
Short but very precise information… Thank you for sharing this one.
A must read post!
Does your website have a contact page? I’m having trouble locating it but, I’d like to send you
an email. I’ve got some suggestions for your blog
you might be interested in hearing. Either way, great site and I look forward
to seeing it grow over time.
It’s a pity you don’t have a donate button!
I’d without a doubt donate to this brilliant blog! I suppose for now i’ll settle for bookmarking and adding
your RSS feed to my Google account. I look forward to brand new updates and will share this
website with my Facebook group. Talk soon!
Wonderful goods from you, man. I’ve understand your stuff
previous to and you’re just too great. I actually like what you have acquired here, really like what you’re stating and the way in which you say it.
You make it entertaining and you still take care of to keep it sensible.
I can not wait to read much more from you. This is actually a great web site.
What’s Going down i’m new to this, I stumbled upon this I have
discovered It positively helpful and it has aided me out loads.
I am hoping to contribute & help different customers like its
helped me. Great job.
Your style is really unique compared to other folks I
have read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just book mark this
web site.
Great article.
Whoa! This blog looks exactly like my old one! It’s on a entirely different
topic but it has pretty much the same layout and design. Excellent choice of colors!
It’s remarkable to go to see this website and reading the views
of all friends on the topic of this piece of writing, while I am also zealous of getting experience.
Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is important and all. Nevertheless imagine if you added some great images or videos to give your posts more, “pop”!
Your content is excellent but with pics and video clips,
this site could definitely be one of the greatest in its field.
Very good blog!
Good web site you have got here.. It’s difficult to find high-quality writing like yours
these days. I really appreciate individuals like you!
Take care!!
Thank You! it’s very helpful and I have updated PHP 7.2 to PHP 7.4 in my Ubuntu OS 18.04 with Vesta installed