Score:0

Apache2.4 AddType for PHP 5.6 Fails/Ignored

in flag

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.

in flag
Did you install the `libapache2-mod-php` package before trying to compile your own PHP? Without it, Apache will not use the installed PHP environment. If you hadn't, then you should install that package, so you won't need to compile anything.
arvind avatar
in flag
@Lacek `modules/libphp5.so` was already compiled at first stage
arvind avatar
in flag
Plus, PHP 5.6 is not available even after adding `ppa:ondrej/php`. Hence I had to compile PHP
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.