I want to install Apache version 2.4.28 and PHP version 5.6 on Ubuntu 16.04.
I installed successfully but they did not work together because when I install apache 2.4.28 I can't use:
apt-get install apache2----> this commmand just install apache 2.4.18.
Instead, I compile apache 2.4.28 from source as link.
Then I use apt-get to install PHP 5.6. Because default PHP for Ubuntu 16.04 is PHP7.0, I use this command to install PHP5.6:
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php5.6
So, when I test PHP:
<?php
echo "Hello world";
?>
It show blank page, not print "Hello world".
root@ubuntu:/usr/local/apache2/conf# ps -aux | grep httpd
root 57261 0.0 0.1 75276 3844 ? Ss 08:21 0:00 /usr/local/apache2/bin/httpd -k start
daemon 57262 0.0 0.2 364240 5760 ? Sl 08:21 0:00 /usr/local/apache2/bin/httpd -k start
daemon 57263 0.0 0.2 364240 5760 ? Sl 08:21 0:00 /usr/local/apache2/bin/httpd -k start
daemon 57264 0.0 0.3 429776 6100 ? Sl 08:21 0:00 /usr/local/apache2/bin/httpd -k start
root 57647 0.0 0.0 21296 944 pts/17 S+ 08:55 0:00 grep --color=auto httpd
I think it many something wrong in configure PHP path or apache path. But I don't know how to fix it. Please help me. Thanks in advance.
sudo apachectl -M | grep -i php
? Have you configured avirtual host
and enabled it as well in apache ? – Michal Przybylowicz Oct 13 '17 at 18:38