Installing php 5.2 ubuntu

2019-09-02 00:13发布

问题:

I want to install php 5.2.x on my server. I can't find any way to do this. I removed php from the server. My server is running ubuntu.

I tried to follow this one without success. https://askubuntu.com/questions/262368/is-there-any-repository-for-installing-php-5-2-x-on-ubuntu-12-04

回答1:

Try this:

sudo add-apt-repository ppa:txwikinger/php5.2
sudo apt-get update

then you should be able to install php5.2 with apt-get install but that's really old stuff now that PHP 7 has been released !

if that's not possible add these two lines to /etc/apt/sources.list add do a sudo apt-get update



回答2:

Install Apache

https://manishpaneri.blogspot.in

Install PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Enabling mod_rewrite

sudo a2enmod rewrite

This will activate the module or alert you that the module is already in effect. To put these changes into effect, restart Apache.

sudo service apache2 restart

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get upgrade

curl install

sudo apt-get install php-curl

Setting Up .htaccess

First, allow changes in the .htaccess file. Open the default Apache configuration file using nano or your favorite text editor##.

/etc/apache2/sites-available$ sudo gedit 000-default.conf

Inside that file, you will find the <VirtualHost *:80> ....</VirtualHost>. Inside of line

<Directory /var/www/html>

           Options Indexes FollowSymLinks MultiViews
            AllowOverride All
           Order allow,deny
            allow from all

</Directory>

restart Apache.

sudo service apache2 restart

sudo apt-get install php-mcrypt

create the .htaccess file.

sudo nano /var/www/html/.htaccess

To check your hostname run:

hostname hostname -f



标签: php linux ubuntu