Apache won't recognize Php 5.3.29 on Ubuntu 14.04 - php

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

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!

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

Install and configure PHP5 and 7 on same Ubuntu server

I have installed both PHP versions (php5 & php7) on the same Linux server and it works for me, when I switch the version configuration on system.
Also it shows changes happen in the info.php file in the browser, but in terminal using php -v ,it shows only php7 version installed though it works under php5.
how can i correct the version information in php5 while chk in terminal?
When PHP is installed side to side there are different executables for the different versions. When you use a Web Server you choose which version to use via its configuration.
If php -v shows PHP 7 try php5 -v. If this returns the right version you can use php5 to run any script with php5.
To find out where exactly the PHP executables are use:
which php
whereis php
which php7
whereis php7

php version showing different in application/browser

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).

Ubuntu uses removed PHP version

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

Categories