Ubuntu VirtualMin - Won't see PhP Versions - php

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.

Related

Ubuntu 18.04 using PHP version that is not installed as a module

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!

Upgrading from php7.0.33 to php7.3 on Debian 10 (Buster)

I have a web server running on virtual machine Debian 10 (Buster)
I need to upgrade the PHP 7.0.33 to PHP 7.1 or higher, and as you know, debian buster already has PHP 7.3 ready to be installed.
the problem is when i try to sudo apt-get install php7.3-cli or any other php extension it asks me to remove local custome packages which are essential for the web server becase they depends on the old php version.
I tried to do sudo apt-mark hold <custom_package>, but it is still asking me to remove them and preventing me from upgrading/installing the new php version.
How to fix this issue?
Am i doing something wrong?
the reason for upgrading the php is that the upgraded version of web server content requires php version to be 7.1 or higher, i even tried to neglect this platform check, the web server worked but with issues which make the server unfuntional.
Sorry, i'm new to this and just trying to resolve the problem.
Regards,

Installing PHP 7.4 on macOS Sierra without brew?

I am unable to find any info on installing PHP 7.4, all the info seems to go untill 7.3 but that has not been helpful.
What I have done so far is execute:
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.4
And this is the message I got:
It doesn't seem to install. How can I solve this problem?
If you check the script https://php-osx.liip.ch/install.sh you can see it only support 7.3
Yes, you can install and upgrade to latest php version on mac without homebrew.
For me I use MacPorts a package manager for MacOS which is similar to HomeBrew but more stable.
Example to upgrade to php74:
sudo port install php74
Install the extensions you need
sudo port install php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache php74-xsl php74-sqlite
Select php74 as the active PHP version. With this command you can have multiple php version and quickly switch from one to the other.
sudo port select php php74
Check which PHP binary is used (should return /opt/local/bin/php). Perhaps you may need to restart you terminal.
which php
Check the version (should return “PHP 7.4.XX (cli)…”)
php --version
Also, If you use XAMPP ensure to restart Apache Web server.
(Article Reference)

Multiple php versions - how to update php version in Wordpress settings

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

PHP version must be equal or higher than 5.6

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

Categories