I have updated php to 7.0. php -v return 7.0.11. But phpinfo() return 5.5.9.
Can anyone help me?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Did you switched PHP modules on Apache? You should first disable PHP5.6 module then enable PHP7 module and restart Apache. To disable PHP5.6 on Apache execute :
- sudo a2dismod php5.6
Now you should enable PHP7 ones:
- sudo a2enmod php7.0
To reflect changes Apache restart is required:
- sudo systemctl restart apache2
Try again phpinfo, and report is it or we need to try something other. :) Edit: try with php5.5 if php5.6 returns not exist module, I noticed it late :P
This is a common issue and typically arises from the fact that the PHP version being used by your command line (CLI) can be different from the one being used by your web server. In your case, PHP 7.0 is installed and available via the command line, but your web server (probably Apache or Nginx with PHP-FPM) is still using PHP 5.5.
To solve this, you need to make sure that your web server is configured to use the correct version of PHP. How to do this depends on your exact server setup. Below are general steps for both Apache and Nginx.
For Apache:
You might have multiple versions of libphp installed and Apache is configured to use the older one.
Disable the old PHP module: sudo a2dismod php5.5 (or whatever version is currently enabled)
Enable the new PHP module: sudo a2enmod php7.0
Restart Apache to apply changes: sudo systemctl restart apache2
For Nginx with PHP-FPM:
Find your Nginx site configuration (usually located at /etc/nginx/sites-available/).
In the server block, locate the fastcgi_pass directive inside the PHP location block. It should look something like this:
location ~ \.php$ {
# ...
fastcgi_pass unix:/var/run/php/php5.5-fpm.sock;
# ...
}
fastcgi_pass directive to point to the PHP 7.0 FPM socket. It might look like this:location ~ \.php$ {
# ...
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# ...
}
Restart Nginx to apply changes: sudo systemctl restart nginx
Also ensure that PHP 7.0 FPM service is running. If it’s not, start it: sudo systemctl start php7.0-fpm
Please adjust the commands and paths as necessary according to your actual server setup. The version numbers and paths might vary depending on how PHP was installed and configured on your server. If these instructions do not help or if you’re using a different web server, please provide more details about your setup.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.