Phiên bản cài đặt này đã được thử nghiệm trên Ubuntu 15.01 nhưng có thể được sử dụng cho một máy chủ sản xuất Debian.

SuPhp đã không được bảo trì trong vài năm nay, vì vậy nó không còn trong các kho lưu trữ của các phân phối gần đây, và trở nên khó để biên dịch nó trên một nhân 4.x (đó là trường hợp của tôi, kể từ khi chuyển sang Ubuntu 15.10).

Chú ý: gói vẫn có sẵn trên Ubuntu 14.01LTS.

1 – Cài đặt các gói cơ bản.

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 libmcrypt4 libmcrypt-dev libpspell-dev libedit2 libedit-dev libsnmp30 libsnmp-dev libxslt1.1 libxslt1-dev postgresql-server-dev-9.4 postgresql-server-dev-all

2- Biên dịch PHP

Đầu tiên, chúng ta tạo một liên kết tượng trưng cho một thư viện có thể thiếu trong quá trình biên dịch:

sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

Chúng ta lấy mã nguồn PHP:

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

Sau đó chúng ta biên dịch:

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

3- Cấu hình Apache:
Chúng ta tham chiếu đến thư mục của chúng ta nơi PHP được đặt, trong tệp cấu hình apache2 /etc/apache2/apache2.conf

sudo vi /etc/apache2/apache2.conf

ScriptAlias /php5.6.16/ "/usr/local/php/bin/"
<Directory "/usr/local/php/bin/">
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>

Sau đó chúng ta tiến hành cấu hình máy chủ ảo của mình với các chỉ thị sau:

Action php-script '/php5.6.16/php-cgi-5.6.16'
AddHandler php-script .php
PHPIniDir "/var/www/ATLV/"

Điều này cho chúng ta một cấu hình như sau:

<VirtualHost *:80>
Options FollowSymLinks
DirectoryIndex app_dev.php
ServerName www.kuoni.dev
DocumentRoot /var/www/ATLV/web

Action php-script '/php5.6.16/php-cgi-5.6.16'
AddHandler php-script .php
PHPIniDir "/var/www/ATLV/"
<Directory /var/www/ATLV/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
DirectoryIndex app_dev.php
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Chúng ta chỉ cần kích hoạt mod hành động:

a2enmod actions

Và khởi động lại apache2:

service apache2 restart

Và xong:

 

Selection_050