Difference between revisions of "Apache 2"

Line 61: Line 61:
  
 
source: http://www.podciborski.co.uk/miscellaneous/snmp-cannot-find-module/
 
source: http://www.podciborski.co.uk/miscellaneous/snmp-cannot-find-module/
 +
 +
 +
==PHP 7==
 +
 +
2016-09: Even though PHP7 has been released in 2015 it is not in the official repositories because '''it is not 100% backward compatible with PHP5'''. As it is not in the repositories '''you must install all applications manually''' (PHPMyAdmin, etc.)
 +
 +
 +
The following instructions are based on https://www.justegeek.fr/installer-php-7-0-apache2-debian-8/ && http://www.configserverfirewall.com/ubuntu-linux/install-php-7-on-ubuntu-14/
 +
 +
 +
===PHP7 repository===
 +
 +
Add a new repository:
 +
 +
DEBIAN
 +
<syntaxhighlight lang="bash">
 +
echo "deb http://packages.dotdeb.org jessie all" > /etc/apt/sources.list.d/dotdeb.list
 +
wget https://www.dotdeb.org/dotdeb.gpg && apt-key add dotdeb.gpg
 +
apt-get update
 +
</syntaxhighlight>
 +
 +
UBUNTU SERVER
 +
<syntaxhighlight lang="bash">
 +
add-apt-repository ppa:ondrej/php-7.0
 +
apt-get update
 +
</syntaxhighlight>
 +
 +
 +
===Installation===
 +
 +
Remove PHP5 packages, if any:
 +
<syntaxhighlight lang="bash">
 +
apt-get --purge remove php5*
 +
</syntaxhighlight>
 +
 +
 +
Install core packages
 +
<syntaxhighlight lang="bash">
 +
apt-get install php7.0 php7.0-fpm
 +
 +
# Debug symbols
 +
apt-get install php7.0-dev
 +
</syntaxhighlight>
 +
 +
 +
===Modules PHP7===
 +
 +
<syntaxhighlight lang="bash">
 +
apt-get install php7.0-cli php7.0-cgi
 +
apt-get install php7.0-gd
 +
apt-get install php7.0-bz2
 +
apt-get install php7.0-curl
 +
apt-get install php7.0-xmlrpc php7.0-xsl
 +
apt-get install php7.0-soap
 +
apt-get install php7.0-json
 +
apt-get install php7.0-mysql
 +
apt-get install php7.0-memcached
 +
apt-get install php7.0-mcrypt mcrypt
 +
apt-get install php7.0-imap
 +
apt-get install php7.0-snmp
 +
</syntaxhighlight>
 +
 +
 +
===Utility===
 +
 +
<syntaxhighlight lang="bash">
 +
php-pear
 +
</syntaxhighlight>
 +
 +
 +
===Configuration===
 +
 +
Edit '''PHP config''' file:
 +
 +
<syntaxhighlight lang="bash">
 +
vim /etc/php/7.0/cli/php.ini
 +
vim /etc/php/7.0/fpm/php.ini
 +
</syntaxhighlight>
 +
 +
* Let CGI behaves like before: set <code>cgi.fix_pathinfo=1</code>
 +
 +
 +
Edit '''PHP port'''
 +
 +
<syntaxhighlight lang="bash">
 +
vim /etc/php/7.0/fpm/pool.d/www.conf
 +
</syntaxhighlight>
 +
 +
 +
<syntaxhighlight lang="php">
 +
; Replace (old line)   
 +
listen = /run/php/php7.0-fpm.sock
 +
 +
; New values
 +
listen = 127.0.0.1:9000
 +
</syntaxhighlight>
 +
 +
 +
===Check PHP version and configuration===
 +
 +
To ensure PHP 7.0 is well-installed just type:
 +
 +
<syntaxhighlight lang="bash">
 +
php -v
 +
</syntaxhighlight>
  
  
Line 66: Line 171:
 
==PHP 5==
 
==PHP 5==
  
 +
2016-09: PHP5 is the only version in the OFFICIAL repositories.
  
 
===Core===
 
===Core===

Revision as of 19:17, 27 September 2016



Requirements

Before going through this tutorial, I recommend you to setup:



Installation

Apache 2

This will install web server + PHP + Perl + all required libraries.

Apache2 core

apt-get install apache2 apache2-mpm-prefork apache2-utils ssl-cert


Additional libraries

apt-get install libapache2-mod-fcgid libruby


Doc

apt-get install apache2-doc


Perl

apt-get install libapache2-mod-perl2 libapache2-mod-perl2-doc


SNMP

Sometimes you might encounter some SNMP errors on latest Debian based distributions.

In that case you have to install a new package and run it.

apt-get install snmp-mibs-downloader
download-mibs


source: http://www.podciborski.co.uk/miscellaneous/snmp-cannot-find-module/


PHP 7

2016-09: Even though PHP7 has been released in 2015 it is not in the official repositories because it is not 100% backward compatible with PHP5. As it is not in the repositories you must install all applications manually (PHPMyAdmin, etc.)


The following instructions are based on https://www.justegeek.fr/installer-php-7-0-apache2-debian-8/ && http://www.configserverfirewall.com/ubuntu-linux/install-php-7-on-ubuntu-14/


PHP7 repository

Add a new repository:

DEBIAN

echo "deb http://packages.dotdeb.org jessie all" > /etc/apt/sources.list.d/dotdeb.list
wget https://www.dotdeb.org/dotdeb.gpg && apt-key add dotdeb.gpg
apt-get update

UBUNTU SERVER

add-apt-repository ppa:ondrej/php-7.0
apt-get update


Installation

Remove PHP5 packages, if any:

apt-get --purge remove php5*


Install core packages

apt-get install php7.0 php7.0-fpm

# Debug symbols
apt-get install php7.0-dev


Modules PHP7

apt-get install php7.0-cli php7.0-cgi
apt-get install php7.0-gd 
apt-get install php7.0-bz2 
apt-get install php7.0-curl 
apt-get install php7.0-xmlrpc php7.0-xsl 
apt-get install php7.0-soap
apt-get install php7.0-json 
apt-get install php7.0-mysql 
apt-get install php7.0-memcached
apt-get install php7.0-mcrypt mcrypt
apt-get install php7.0-imap 
apt-get install php7.0-snmp


Utility

php-pear


Configuration

Edit PHP config file:

vim /etc/php/7.0/cli/php.ini
vim /etc/php/7.0/fpm/php.ini
  • Let CGI behaves like before: set cgi.fix_pathinfo=1


Edit PHP port

vim /etc/php/7.0/fpm/pool.d/www.conf


; Replace (old line)    
listen = /run/php/php7.0-fpm.sock

; New values
listen = 127.0.0.1:9000


Check PHP version and configuration

To ensure PHP 7.0 is well-installed just type:

php -v


PHP 5

2016-09: PHP5 is the only version in the OFFICIAL repositories.

Core

apt-get install libapache2-mod-php5 php5 php5-common


Modules PHP5

apt-get install php5-cli php5-cgi
apt-get install php5-curl php5-xmlrpc php5-xsl php5-dev php-pear 
apt-get install php5-mysql 
apt-get install php5-memcache php5-xcache
apt-get install php5-mhash php-auth php5-mcrypt mcrypt
apt-get install php5-imap 
apt-get install php5-snmp


Image Magick

apt-get install php5-gd php5-imagick imagemagick


Configuration

Edit PHP config file:

vim /etc/php5/apache2/php.ini

Add / uncomment the following lines in Dynamic extensions area (~ line 865)

  • extension=mysql.so
  • extension=gd.so


!! Note this is NOT required on Ubuntu 14.04 because these modules are enabled by default !!


Firewall

see Firewall INPUT filters#Web server

Restart the firewall

/etc/init.d/firewall restart


Test your installation

Restart the Apache2 server

service apache2 restart


You can now test your installation by going to 'http://localhost' or 'http://myServer'. You should see the default page.