3

I am very new to linux and setting up PHP in the server.

When I try to do a php -v, the php version is returning a version of 7.0, but when I checked the php version in phpinfo(), it is returning 5.5.9.

My question here is that how can I make both versions to be the same, like when I checked in to the phpinfo(), it should also have 7.0 version.

Your help would be greatly appreciated! Thank you!

2 Answers 2

3

First you will need to remove the php by following command. This will remove both i.e php 5 and 7.

sudo apt purge php*

Now install php7.0

sudo apt -y install php7.0 libapache2-mod-php7.0

Then restart Apache:

systemctl restart apache2
Sign up to request clarification or add additional context in comments.

Comments

0

Probably, you have a ubuntu version with PHP already installed on it. Then you installed another php on it, like xampp.

Try to diagnose your own problem.

Get know which php used by CLI by type:

Which php

If you want to keep only PHP 5 running on your machine, then you must set the variable environment of your bash to running php.exe from php5 directory. Restart your machine and test it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.