I have updated PHP 5.5.9 to PHP 5.6.31 using the command lines in Ubuntu.
This is the picture
And then I was trying to install CakePHP, but it is showing that "your PHP version must be equal or higher than 5.6.0 to use CakePHP."
This is the error message of cakePHP
I am doing work in Linux(Ubuntu) Operating system.
What can I do now?
Your PHP CLI version and the version configured with your web server can very well be different. If you check phpinfo(), you can see exactly what paths and what not are in use.
I have found the solution. PHP CLI and PHP Apache are the different module. We have to notice the Apache server PHP version which is showing by-
<?php
phpinfo()
?>
To run the same version, first I disabled the PHP 5.5.9 version-
sudo a2dismod php5
Then I enabled the PHP 5.6 version-
sudo a2enmod php5.6
Restart the server-
sudo service apache2 restart
Related
Using the commmand php -v on a Ubuntu 18.04 server is displaying PHP version 8.1.14, but no PHP8.* module is installed.
I have tried running the command: sudo update-alternatives --config php which displays:
Available PHP versions
Disabling the PHP8.1 module will show me that the module is not installed:
module not installed
While php -v is really showing me PHP8.1:
PHP version
I have tried to purge the PHP 8 version with the following command:
sudo apt-get purge php8.*
It showed me 0 modules were marked for removal, just to be sure I also ran autoremove & autoclean commands.
When I display the PHP info, it also shows the 8.1 version:
PHP info
I need to get the server back to version 7.4 to make some installations function properly, I have tried all options above but did not succeed. How can I downgrade to PHP Version 7.4?
While I was installing the PHP Selector add-on for DirectAdmin, I noticed Zend modules were being installed for 7.4. Perhaps these were missing for the server to switch back to version 7.4. Problem solved!
I have a fresh ubuntu server installed with virtualmin. It autoinstalls Php version 7.2, I need 7.4. So I install 7.4. When I check the version with -v it shows 7.4. However, webmin and wordpress both still see and use only 7.2. I've tried uninstalling 7.2 but the command fails and tells me that module doesn't exist when I can show it in the list of installed versions in ssh. Its just not showing up as an option in virtualmin when I go to change the php version. Only showing 7.2.
Any advice on where I should be looking to resolve this? I'm feeling stumped. Thanks!
You can try with below command :
sudo update-alternatives --set php /usr/bin/php7.4
For more details you can refer below link as well :
https://hackthestuff.com/article/how-to-change-php-version-from-command-line-in-ubuntu
The right way of changing PHP version for the given virtual server in Virtualmin is done using Server Configuration ⇾ PHP Options page.
Using update-alternatives command will change default PHP (CLI) version system-wide. It won't be applied to virtual-servers.
You may find our Virtualmin Community forum helpful.
I am a new Linux Mint user. In my computer I found PHP version 7.1 from phpinfo() like below
I found PHP version 7.4.3 from terminal like below
My /etc/php/ folder is like below
Which PHP version am I using ?
Try in your terminal
which php
your will find your terminal PHP path.
You have multiple versions installed and you're using the version that PHP tells you you are using.
When you use the webserver module version of PHP it is version 7.1.33. When you use the command line version you are using 7.4.3.
You might also have 7.0 and 7.2 installed (or they may be folders for leftover config files in versions that have since been uninstalled).
Disable php 7.1 module on Apache
sudo a2dismod php7.1
and enable php 7.4
sudo a2enmod php7.4
sudo systemctl restart apache2
The php version used by the CLI and the one used by apache CAN be different.
The installed versions are listed in your /etc/php/ folder as you already emntioned.
To switch the used version for apache you can use the following commands:
sudo a2dismod php7.1
sudo a2enmod php7.4
Also you have to restart your apache afterwards.
Reference: https://serverfault.com/questions/149039/how-to-change-what-version-of-php-apache2-uses
I have a Ubuntu Apache2 server where I have updated PHP to 7.3.
I can see from /etc/php/ PHP-versions from 5.6. to 7.3. installed.
php -r "phpinfo();" | grep php.ini
Confirms me that the latest version is being used.
However, a Wordpress -website running on the server, is still using the old PHP 7.0. How can I configure Wordpress to use the new version instead? I haven't found the php path defined in any of the wordpress files.
After updating the php to version 7.3, you should enable that mode in apache configuration.
Run this command:
sudo a2enmod php7.3
I have installed ubuntu/trusty64 using vagrant on my windows pc. I have installed all the required package for php development environment.
Now problem is while I check php version on browser it's showing different from terminal.
From application browser showing :
PHP Version 5.5.9-1ubuntu4.20
Terminal showing:
PHP 5.6.27-1+deb.sury.org~trusty+1 (cli)
Why different version showing on my application?
Please let me know how can I sync up application with php 5.6.27 ?
//php 7.0 to php 7.2 switcher
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo systemctl restart apache2
sudo ln -sfn /usr/bin/php7.2 /etc/alternatives/php
If I understood your question correctly, then the difference between your terminal and the application is the PHP source that they are getting the information from. If you had installed PHP apart from your application, that's why is showing different versions.
To change this (for example that you want to have only the PHP that your terminal is displaying:PHP 5.6.27-1+deb.sury.org~trusty+1 (cli), then change the pointer from your application to point to the directory where PHP 5.6 is installed (For Ubuntu: /usr/share/php5).