I use Ubuntu14.04 and I had PHP 5.5.9 installed.
I removed the PHP 5.5.9.
Then I downloaded an installed PHP 5.4.42
and I tried this:
echo "deb http://packages.dotdeb.org squeeze-php54 all" | sudo tee -a /etc/apt/sources.list
apt-get install php5=5.4.41-1~dotdeb+6.1
The result is:
php -v
5.4.42
echo phpversion();
5.5.9
Why does Ubuntu still use PHP 5.5.9?
i am not sure but here is one method that you can try to make ubuntu use php 5.4 forcefully.
you will need to alter the .htaccess file in order to run all PHP scripts using PHP 5.4:
AddHandler x-mapp-php6 .php
for more infor visit : https://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/php-c37728/manually-set-the-version-of-php-using-an-htaccess-file-a614325.html
I recently got these problem in my Ubuntu 14.04
I searched many ways. but finally i have to installed Ubuntu 12.04
because Ubuntu 14.04 support only PHP 5.5 and above version.
so dont waste time. just Installed Ubuntu 12.04
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 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 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!
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
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.
I have struggled to make Apache recognize Php 5.3.29 (I need it to run a very old Drupal 6 website).
I am using a Google Cloud Platform VM running Ubuntu 14.04 LTS.
I successfully installed PHP 5.3.29 by compiling it and now running
# php -v
shows The correct version PHP 5.3.29. However after installing Apache I couldn't get it to recognize that version of PHP, it couldn't even compile PHP.
So I read somewhere that I need to run
sudo apt-get install libapache2-mod-php5
But when i do that and run an info.php file with
<?php
phpinfo()
?>
I get PHP Version 5.5.12-2ubuntu4.4
My question is: How can I make it so Apache will point/recognize The older PHP version 5.3.29 ?
When you compile php from tarball
./configure \
--with-apxs2=/usr/bin/apxs2 //path to your apxs2 file
//... more config options
make
make test
make install
After that simple resatart apache
I'm on Ubuntu 12.04 64 bit, I decided to upgrade to PHP 5.5 from 5.3 and apache2 2.2 to 2.4. I did something similar to Installing apache 2.4 and php 5.5 on ubuntu 12.04. Long story short something's broken and it's not working correctly so I want to go back to PHP 5.3 and apache2 2.2.
Is it just a case of uninstalling PHP and Apache, removing the sources I added, do a package update and then reinstalling PHP and Apache using apt? I just want to go back to a version of PHP and Apache that work correctly and are supported by 12.04.
Thanks.
Remove the files in /etc/apt/sources.list.d/ that matches the ppa names you added. You should find one like ondrej
Run then sudo apt-get update && sudo apt-get install php5 apache2 and you should have all back working
I've used ondrej ppa too (There are apache 2.4 and mysql 5.6 too from the same author which works really well for me, https://launchpad.net/~ondrej)