3

I have successfully installed PHP 7 using this link.

When I run following command in terminal

php -v

it successfully show that PHP 7 version detail.

But when I run a test.php file (made in web accessible folder and it has below content )

<?php
phpinfo();

in browser like localhost/test.php it still shows me my older version of PHP ie 5.5.9.

In browser every PHP script works fine but with PHP 5.5.9 not with PHP 7

And In terminal every PHP script works fine with PHP 7 but in browser, it works with PHP 5.5.9 not with PHP 7.

For example a file ano_class.php having anonymous class feature added in PHP 7 works as fine in terminal by following command

php ano_class.php

It successfully print expected results, but when I run the same file in browser like localhost/ano_class.php it gives me syntax error because anonymous class is not supported in PHP 5.5.9

I have done many research on internet but doesn't get the answer

Though I have referred many website, I referred here too.

How to get PHP 7 running in non CLI mode?

(I am using LAMP IN Kubuntu 14.04 )

1 Answers1

2

Depends on your webserver I am going to assume apache2 and will assume that you have

If you have php7 enabled in apache it should look something like

ls /etc/apache2/mods-enabled/ | grep php
php7.0.conf
php7.0.load

If you see php5 in there try

ls /etc/apache2/mods-availible/ | grep php

If php7.0 is an availible mod you should be able to

sudo a2dismod php5
sudo a2enmod php7.0
sudo service apache2 restart