Check Apache version by PHP

Beside use command to check the version, you can use the php script to check the php version. Why that so? So application do need to verify by php first before allow you to install the apps.

<?php

$ar = split("[/ ]",$_SERVER['SERVER_SOFTWARE']);
for ($i=0;$i<(count($ar));$i++)
{
switch(strtoupper($ar[$i]))
{
case 'APACHE':
$i++;
$Apache_Version = $ar[$i];
break;
case 'PHP':
$i++;
$PHP_Version = $ar[$i];
break;
case 'MOD_SSL':
$i++;
$MOD_SSL_Version = $ar[$i];
break;
case 'OPENSSL':
$i++;
$OPENSSL_Version = $ar[$i];
break;
}
}

Echo "Apache Version: $Apache_Version<br>\n";
Echo "PHP Version: $PHP_Version<br>\n";
Echo "mod_ssl Version: $MOD_SSL_Version<br>\n";
Echo "OpenSSL Version: $OPENSSL_Version<br>\n";

?>

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

When you restart the httpd, the error as below shwo

(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

First, list out the process that hold port 80

netstat -lnp | grep :80

Then kill it

sudo kill -9 PID

Note: PID=process ID

You should be able to restart the httpd after kill the proccess. Usually is those NOBODY holding the process. If you are still unable to kill all the NOBODY proccess, it might have hardware issue from my experience .

Apache: Install SSL manually

(1) To install the SSL to the Apache server, first thing that need done is locate is the Virtual Host File. On most Apache servers the Virtual Sites are configured in the /etc/httpd/conf/httpd.conf file. However it can vary from server to server.

(2) Identify the secure Virtual Host for your site which is with port 443. Please make sure it in dedicated IP and not the share IP.

(3) Configure the Virtual Host For SSL as below.

< VirtualHost 192.168.0.1:443 >
DocumentRoot /var/www/html2
ServerName www.yourdomain.com
SSLEngine on
SSLCertificateFile /path/to/your_domain_name.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
< /VirtualHost >

(4)Save the changes to your configuration file

(5)Verify that the all the key,crt and etc is saved to the path you configured.

(6)Restart Apache