Skip to content

Instantly share code, notes, and snippets.

@jorwan
Forked from frangeris/setup.sh
Created July 11, 2014 21:21
Show Gist options
  • Save jorwan/e0d667fb89ea7ef70916 to your computer and use it in GitHub Desktop.
Save jorwan/e0d667fb89ea7ef70916 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Install dependencies
yum update -y
yum install -y gcc apr-devel apr-util-devel openssl-devel pcre-devel libxml2-devel libcurl-devel
# Or just make your own installation for apr
mkdir setup && cd setup
wget <url_to_apache>.tar.gz
tar -zxvf <apache>.tar.gz
# Download and unpack apr
cd <apache>/srclib
wget <url_to_apr>
wget <url_to_apr-util>
tar -xvf <apr>.tar.gz
tar -xvf <apr-util>.tar.gz
mv <apr> apr
mv <apr-util> apr-util
cd ..
# Configure apache with custom prefix
./configure --prefix=/etc/httpd --enable-so --enable-ssl --with-included-apr
# Compile, link and install apache locally
make && make install
cd ..
# Get php source code
wget <url_to_php_file>
tar -zxvf <php>.tar.gz
cd <php>
# Configure build for PHP 5.5 FPM and Apache 2.4 running on mod_proxy_fcgi
./configure '--with-libdir=lib64' '--enable-libxml' '--enable-simplexml' '--enable-zip' '--enable-filter' '--enable-inline-optimization' '--with-pic' '--with-gnu-ld' '--prefix=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--with-pear' '--enable-sockets' '--with-zlib' '--enable-soap' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-curl=/opt/curlssl/' '--with-pdo-sqlite' '--with-openssl' '--with-freetype-dir=/usr' '--with-gettext' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-intl' '--with-apxs2=/etc/httpd/bin/apxs' '--with-config-file-path=/etc' '--with-xpm-dir=/usr' '--enable-mbstring' '--enable-mbregex' '--enable-fpm'
# '--enable-pthreads'
# '--with-config-file-path=/etc'
# '--enable-maintainer-zts' for zts extensions
# '--enable-memcache' for memcached
# '--with-pdo_pgsql=/usr/pgsql' for PostgreSQL
# Compile and install php
make && make install
# Set handler for php files
echo '
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
' >> /usr/local/apache2/conf/httpd.conf
# Add test file
echo '<?php phpinfo();' > /usr/local/apache2/htdocs/index.php
# For each VirtualHost directive
# Proxy for 2.4
<IfModule proxy_module>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/<route_to_public_html>/$1
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment