Skip to content

Instantly share code, notes, and snippets.

@frangeris frangeris/ forked from boo1ean/
Last active Aug 29, 2015

What would you like to do?
Setup guide for server environment for PHP over power
#!/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 libpng-devel libjpeg-devel libXpm-devel freetype-devel libicu-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
# 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
# Installing Apache 2.4 with easyphp - whm
# Add to file /var/cpanel/easy/apache/rawopts/Apache2_4
# --enable-proxy-fcgi=static
# 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
# '--with-pdo_pgsql=/usr/pgsql' for PostgreSQL
# default location of php-fpm.conf /usr/local/etc
# Compile and install php
make && make install
# Memcache extension
phpize --clean && phpize
./configure --with-php-config=/path/to/php/bin/php-config
# Set handler for php files without php-fpm
echo '
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
' >> /usr/local/apache2/conf/httpd.conf
# Add test file
echo '<?php phpinfo();' > /usr/local/apache2/htdocs/index.php
# For each VirtualHost directive proxy 2.4
<IfModule proxy_module>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://<route_to_public_html>/$1
./configure '--with-libdir=lib64' '--with-kerberos' '--with-imap-ssl'

This comment has been minimized.

Copy link
Owner Author

frangeris commented Apr 21, 2014

zts needs zend_extension= instead of extension= when compiling with directives '--enable-debug' '--enable-maintainer-zts'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.