Compilar apache amb php

openssl

./config --prefix=/path_to_dir/openssl-1.0.0e
make
make install

apache

apr

./configure --prefix=/path_to_dir/apr-1.5.1
make
make install

apr-utils

./configure --prefix=/soft/software/apr-util-1.5.4  --with-apr=/path_to_dir/apr-1.5.1/bin/apr-1-config
make
make install

Expat

Download expat-x.x.x.tar.bz2 from https://libexpat.github.io/.

./configure --prefix=/path-to-expat-installation-dir
make
make install

httpd

./configure --prefix=/path_to_dir/httpd-2.4.1 --enable-so --with-ssl=/path_to_dir/  openssl-1.0.2 --enable-ssl --with-apr-util=/path_to_dir/apr-util-1.5.4/bin/apu-1-config  --with-expat=path-to-expat-installation-dir (Aquesta última sempre i quan no estigui expat instalat des d'els repositoris)

Descomentar mod-user-dir y httpd-userdir.conf en httpd.conf

php

PREFIX=/path_to_dir/php-5.3.2 APACHE=/path_to_dir/apache MYSQL=/path_to_dir/mysql 
./configure --prefix=$PREFIX \
     --with-apxs2=$APACHE/bin/apxs \
      --with-mysql=$MYSQL \ (Aquesta sempre i quan no estigui expat instalat des d'els repositoris)
      --with-pdo-mysql \quitar esta
      --with-gd \
      --with-png-dir \
      --with-jpeg-dir \
      --with-freetype-dir \
      --with-zlib-dir= \
      --enable-embed \treure aquesta
      --enable-mbstring


cp /path_to_dir/php-5.4.5/libs/libphp5.so /path_to_dir/apache2/modules/

Obrir httpd.conf i afegir

AddType text/html .php
AddHandler php5-script    .php
## Amb php7
AddHandler php7-script    .php
LoadModule php5_module modules/libphp5.so

Reiniciar apache

cd /usr/local/apache2/bin/
./apachectl restart

Volver al inicio