Thank you for your time reading this post. Server config given to configure (I can't change) snap shot
Please note I can't use add-apt-repository ppa:ondrej/php
, I tried but installing php5.6 packages fails silently as shown here.
I have followed the below steps to configure the above LAMP stack:
wget https://www.php.net/distributions/php-5.6.40.tar.gz
tar -zxvf php-5.6.40.tar.gz
sudo -i
apt install software-properties-common
apt-get update
apt-get install apache2 apache2-dev libxml2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libxpm-dev libmysqlclient-dev libpq-dev libicu-dev libfreetype6-dev libldap2-dev libxslt-dev libssl-dev libldb-dev
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so
ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
apt-get install build-essential
cd /home/ubuntu/php-5.6.40
./configure \
--with-apxs2=/usr/bin/apxs \
--prefix=/usr/local/php \
--enable-mbstring \
--with-curl \
--with-openssl \
--with-xmlrpc \
--enable-soap \
--enable-zip \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-mysqli \
--with-mysql \
--with-pgsql \
--enable-embedded-mysqli \
--with-freetype-dir \
--with-ldap \
--enable-intl \
--with-xsl \
--with-sqlite3 \
--with-zlib
make clean
make
make install
cp php.ini-production /usr/local/lib/php.ini
ln -s /usr/local/lib/php.ini /etc
ln -s /usr/local/php/bin/php /usr/bin/php
vim /etc/apache2/apache2.conf
-------
LoadModule php5_module modules/libphp5.so
AddType application/x-http-php .php
AddType application/x-httpd-php .php
AddType text/x-php .php
DirectoryIndex index.php index.html
-------
a2enmod php5
a2dismod mpm_event
a2enmod mpm_prefork
service apache2 restart
Post all above given steps, I made a test file, but php script gets downloaded instead of executing and sending php info on the browser. This is my issue, any pointers to fix the issue are welcome.