Cette installation est testé sous Ubuntu 14.04LTS mais pourrait etre utilisée pour un serveur debian en production.
Installation des packages de base
sudo apt-get install \
build-essential \
fakeroot dh-make \
debconf execstack \
dh-modaliases \
xserver-xorg-dev \
automake \
autoconf \
libaprutil1 \
libaprutil1-dev \
libsvn-dev \
wx2.8-headers \
libwxgtk2.8-dev \
libxml2-dev \
libpcre3-dev \
libbz2-dev \
libcurl4-openssl-dev \
libjpeg-dev \
libpng12-dev \
libxpm-dev \
libfreetype6-dev \
libmysqlclient-dev \
libt1-dev \
libgd2-xpm-dev \
libgmp-dev \
libsasl2-dev \
libmhash-dev \
unixodbc-dev \
freetds-dev \
libpspell-dev \
libsnmp-dev \
libtidy-dev \
libxslt1-dev \
libmcrypt-dev \
apache2 \
apache2-threaded-dev \
libxml2 \
libaprutil1-dev \
libxml2 \
libxml2-dev \
libssl-dev \
pkg-config \
curl \
libcurl4-nss-dev \
enchant \
libenchant-dev \
libjpeg8 \
libjpeg8-dev \
libpng12-0 \
libpng12-dev \
libvpx1 \
libvpx-dev \
libfreetype6 \
libfreetype6-dev \
libt1-5 \
libt1-dev \
libgmp10 \
libgmp-dev \
libicu52 libicu-dev \
mcrypt \
libmcrypt4 \
libmcrypt-dev \
libpspell-dev \
libedit2 \
libedit-dev libsnmp30 \
libsnmp-dev \
libxslt1.1 \
libxslt1-dev
MAJ pour Ubuntu 15.01
sudo \
apt-get \
install \
build-essential \
fakeroot \
dh-make \
debconf \
execstack \
dh-modaliases \
xserver-xorg-dev \
automake \
autoconf \
libaprutil1 \
libaprutil1-dev \
libsvn-dev \
wx2.8-headers \
libwxgtk2.8-dev \
libxml2-dev \
libpcre3-dev \
libbz2-dev \
libcurl4-openssl-dev \
libjpeg-dev \
libpng12-dev \
libxpm-dev \
libfreetype6-dev \
libmysqlclient-dev \
libgd-dev \
libgmp-dev \
libsasl2-dev \
libmhash-dev \
unixodbc-dev \
freetds-dev \
libpspell-dev \
libsnmp-dev \
libtidy-dev \
libxslt1-dev \
libmcrypt-dev \
apache2 \
apache2-dev \
libxml2 \
libaprutil1-dev \
libxml2 \
libxml2-dev \
libssl-dev \
pkg-config \
curl \
libcurl4-openssl-dev \
enchant \
libenchant-dev \
libjpeg8 \
libjpeg8-dev \
libpng12-0 \
libpng12-dev \
libvpx-dev \
libfreetype6 \
libfreetype6-dev \
libgmp10 \
libgmp-dev \
libicu-dev \
mcrypt \
libmcryp4t \
libmcrypt-dev \
libpspell-dev \
libedit2 \
libedit-dev \
libsnmp30 \
libsnmp-dev \
libxslt1.1 \
libxslt1-dev \
postgresql-server-dev-9.4 \
postgresql-server-dev-all
Compilation de PHP
On commence par faire un lien symbolique d’une lib qui serait potentiellement introuvable lors de la compilation
sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
On récupère les sources de PHP
sudo wget -O php-5.6.2.tar.gz http://fr2.php.net/get/php-5.6.2.tar.gz/from/this/mirror && tar xzvf php-5.6.2.tar.gz && cd php-5.6.2
MAJ php 5.6.16
sudo wget -O php-5.6.16.tar.gz http://fr2.php.net/get/php-5.6.16.tar.gz/from/this/mirror &&\
tar xzvf php-5.6.16.tar.gz &&\
cd php-5.6.16
Puis on compile
sudo \
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/bin/apxs2 \
--with-config-file-path=/usr/local/php/conf \
--with-config-file-scan-dir=/usr/local/php/conf.d \
--enable-debug \
--with-openssl \
--with-kerberos \
--with-zlib \
--enable-calendar \
--with-curl \
--with-enchant \
--enable-exif \
--enable-ftp \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-vpx-dir=/usr \
--with-freetype-dir=/usr \
--with-t1lib \
--enable-exif \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-intl \
--enable-mbstring \
--with-mcrypt \
--with-mysql \
--with-mysqli \
--enable-pcntl \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-pgsql \
--with-pspell \
--with-libedit \
--with-readline \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvshm \
--with-xsl \
--enable-zip \
--with-pear \
--enable-zend-signals \
--enable-maintainer-zts \
--enable-bcmath &&\
sudo make &&\
sudo make install
MAJ pour Ubuntu 15.01
sudo \
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/bin/apxs2 \
--with-config-file-path=/usr/local/php/conf \
--with-config-file-scan-dir=/usr/local/php/conf.d \
--enable-debug \
--with-openssl \
--with-kerberos \
--with-zlib \
--enable-calendar \
--with-curl \
--with-enchant \
--enable-exif \
--enable-ftp \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-vpx-dir=/usr \
--with-freetype-dir=/usr \
--enable-exif \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-intl \
--enable-mbstring \
--with-mcrypt \
--with-mysql \
--with-mysqli \
--enable-pcntl \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-pgsql \
--with-pspell \
--with-libedit \
--with-readline \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvshm \
--with-xsl \
--enable-zip \
--with-pear \
--enable-zend-signals \
--enable-maintainer-zts \
--enable-bcmath &&\
sudo make && \
sudo make install
Compilation de suPhp
On récupère les sources
sudo wget -O suphp-0.7.2.tar.gz http://www.suphp.org/download/suphp-0.7.2.tar.gz &&\
sudo tar xzvf suphp-0.7.2.tar.gz &&\
cd suphp-0.7.2
On créé les différents répertoires de gestion
sudo mkdir /etc/suphp && \
sudo mkdir /var/log/suphp
Il faut ensuite passer quelques commandes pour que la compilation se fasse correctement. Nous utiliserons les commandes suivantes
sudo libtoolize --force #provides libtool support and replaces the default libtool files
sudo aclocal #creates the aclocal.m4 file by consolidating various macro files
sudo autoheader #creates a template file of C ‘#define’ statements
sudo automake --force-missing --add-missing #generates Makefile.in files
sudo autoconf #produces shell scripts for the automatic configuration
On peux déjà tester si on a bien tous les outils sur la machine pour faire la compilation finale en lançant les commandes suivantes :
sudo libtoolize --force &&\
sudo aclocal && sudo autoheader &&\
sudo automake --force-missing --add-missing && sudo autoconf
On créé les liens symboliques pour que les entêtes soient correctement trouvée (normalement ça devrait fonctionner sans cette étape)
sudo ln -s /usr/include/apr-1.0/*.h /usr/include/apache2/
sudo autoreconf -f -i && sudo libtoolize --force && sudo aclocal && sudo autoheader && sudo automake --force-missing --add-missing && sudo autoconf && sudo ./configure --prefix=/usr --sysconfdir=/etc/suphp --with-apache-user=www-data --with-setid-mode=owner --with-apr=/usr/bin/apr-1-config --with-min-uid=33 --with-min-gid=33 --with-logfile=/var/log/suphp
Puis rechercher le fichier src/Makefile puis éditer la ligne MAYBE_AP=apache en MAYBE_AP=apache2.
On peux finalement faire la compilation.
sudo make && sudo make install
Configuration de suPhp
On active les modules les plus courants d’abord (on peux les désactiver au besoin avec « a2dismod »)
sudo a2enmod rewrite
sudo a2enmod suphp
On supprime ensuite l’ensemble des informations présentes dans le fichier conf
sudo a2enmod suphp
On configure maintenant le fichier de conf de suPhp
sudo vi /etc/suphp/suphp.conf
[global]
;Path to logfile
logfile=/var/log/suphp/suphp.log
;Loglevel
loglevel=info
;User Apache is running as
webserver_user=www-data
;Path all scripts have to be in
docroot=/var/www:${HOME}/public_html
;Path to chroot() to before executing script
;chroot=/mychroot
; Security options
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false
;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true
;Send minor error messages to browser
errors_to_browser=false
;PATH environment variable
env_path="/bin:/usr/bin"
;Umask to set, specify in octal notation
umask=0077
; Minimum UID
min_uid=33
; Minimum GID
min_gid=33
[handlers]
;Handler for php-scripts
application/x-httpd-suphp-php-cgi-562="php:/usr/local/php/bin/php-cgi-5.6.2"
;Handler for CGI-scripts
x-suphp-cgi="execute:!self"
Et dernière étape, on fait un vhost pour notre projet.
sudo vi /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
ServerAdmin contact@localhost
ServerName spikly.melis.dev
DocumentRoot /var/www/spikly-hyundai/trunk/melis/front/www
DirectoryIndex index.php
<Directory /var/www/spikly-hyundai/trunk/melis/front/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
DirectoryIndex index.php
</Directory>
suPHP_Engine on
suPHP_ConfigPath /var/www/spikly-hyundai/php.ini
suPHP_AddHandler application/x-httpd-suphp-php-cgi-562
AddHandler application/x-httpd-suphp-php-cgi-562 .php .php3 .php4 .php5
ErrorLog /var/log/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
suPHP_UserGroup tbourdin tbourdin
CustomLog /var/log/access.log combined
</VirtualHost>