Skip to content

Commit

Permalink
- Update README.md for precompiling Apache and PHP
Browse files Browse the repository at this point in the history
- Update compile for bundling apache and php
tar balls from Amazon S3
- Update http.conf for settings
  + Document directory = /app/www/htdocs
  • Loading branch information
Son Nguyen committed Jan 29, 2013
1 parent ee46a23 commit c10be06
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 52 deletions.
140 changes: 92 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,98 @@ The config files are bundled with the build pack itself:
Pre-compiling binaries
----------------------

# apache
mkdir /app
wget http://www.carfab.com/apachesoftware/httpd/httpd-2.4.3.tar.gz
tar xvzf httpd-2.4.3.tar.gz
cd httpd-2.4.3
./configure --prefix=/app/apache --enable-rewrite
make
make install
cd ..

# php
wget http://us2.php.net/get/php-5.4.11.tar.gz/from/us.php.net/mirror
mv mirror php.tar.gz
tar xzvf php.tar.gz
cd php-5.4.11/
./configure --prefix=/app/php --with-apxs2=/app/apache/bin/apxs --with-mysql --with-pdo-mysql --with-pgsql --with-pdo-pgsql --with-iconv --with-gd --with-curl=/usr/lib --with-config-file-path=/app/php --enable-soap=shared --with-libxml --with-simplexml --with-session --with-xmlrpc --with-openssl --enable-mbstring --with-bz2 --with-zlib
make
make install
cd ..

# php extensions
mkdir /app/php/ext
cp /usr/lib/libmysqlclient.so.15 /app/php/ext/
apt-get install php5-mcrypt
cp /usr/lib/php5/20090626/mcrypt.so /app/php/ext/

# pear
apt-get install php5-dev php-pear
pear config-set php_dir /app/php
pecl install apc
mkdir /app/php/include/php/ext/apc
cp /usr/lib/php5/20060613/apc.so /app/php/ext/
cp /usr/include/php5/ext/apc/apc_serializer.h /app/php/include/php/ext/apc/

# utilities
apt-get install zip unzip

# package
cd /app
echo '2.4.3' > apache/VERSION
tar -zcvf apache.tar.gz apache
echo '5.4.11' > php/VERSION
tar -zcvf php.tar.gz php

# create mahara data folder
cd /app
mkdir maharadata
chmod 777 maharadata
# Required software
# - Ubuntu 10.04
# - curl
# - ANSI-C compiler

# This script will set up a heroku cedar platform (Ubuntu 10.04) for Mahara
# 1. Compile apache 2.4.3 and install on /app/apache
# 2. Compile php 5.4.11 + required extensions and install on /app/php

apt-get install curl
mkdir -p /app

# Prepare the filesystem

mkdir -p /tmp/build
cd /tmp/build

# Compiling Apache
curl -L http://www.carfab.com/apachesoftware/httpd/httpd-2.4.3.tar.gz | tar xzf -
cd httpd-2.4.3
cd srclib
curl http://www.us.apache.org/dist//apr/apr-1.4.6.tar.gz | tar xzf -
mv apr-1.4.6 apr
curl http://www.us.apache.org/dist//apr/apr-util-1.5.1.tar.gz | tar xzf -
mv apr-util-1.5.1 apr-util
cd ..
apt-get install libpcre3
apt-get install libpcre3-dev
./configure --prefix=/app/apache --with-included-apr --enable-rewrite
make && make install
cd ..

# Apache libraries
mkdir -p /app/php/ext
cp /app/apache/lib/libapr-1.so.0 /app/php/ext
cp /app/apache/lib/libaprutil-1.so /app/php/ext
cd /app/php/ext
ln -s libapr-1.so.0 libapr-1.so
ln -s libaprutil-1.so.0 libaprutil-1.so
cd /tmp/build

# Compiling PHP
apt-get install libxml2
apt-get install libxml2-dev
apt-get install libssl-dev
apt-get install libvpx-dev
apt-get install libjpeg-dev
apt-get install libpng-dev
apt-get install libXpm-dev
apt-get install libbz2-dev
apt-get install libmcrypt-dev
apt-get install libcurl4-openssl-dev
apt-get install postgresql-server-dev-8.4

curl -L http://php.net/get/php-5.4.9.tar.gz/from/us1.php.net/mirror | tar xzf -
cd php-5.4.9
./configure --prefix=/app/php --with-apxs2=/app/apache/bin/apxs --with-mysql --with-pdo-mysql --with-pgsql --with-pdo-pgsql --with-iconv --with-gd --with-curl=/usr/lib --with-config-file-path=/app/php --enable-soap=shared --enable-libxml --enable-simplexml --enable-session --with-xmlrpc --with-openssl --enable-mbstring --with-bz2 --with-zlib
make && make install
cd ..

# PHP Extensions
apt-get install libmysqlclient-dev
cd /app/php/ext
cp /usr/lib/libmysqlclient.so.16.0.0 .
ln libmysqlclient.so.16.0.0 libmysqlclient.so.16
ln libmysqlclient.so.16.0.0 libmysqlclient.so
cd /tmp/build
# Apache php module
cp /tmp/build/php-5.4.11/libs/libphp5.so /app/apache/modules/

# APC
apt-get install autoconf
curl http://pecl.php.net/get/APC/3.1.14 | tar xzf -
cd APC-3.1.14
/app/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/app/php/bin/php-config
cp .libs/apc.so /app/php/ext
make && make install
cd ..

# Create packages
cd /app
echo '2.4.3' > apache/VERSION
tar -zcvf apache.tar.gz apache
echo '5.4.11' > php/VERSION
tar -zcvf php.tar.gz php

# Upload to your Amazon S3 s3cmd

# s3cmd apache.tar.gz s3://yourbucket/path/to
# s3cmd php.tar.gz s3://yourbucket/path/to



Hacking
Expand Down
7 changes: 5 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ if [ -f www/Procfile ]; then
mv www/Procfile .
fi

APACHE_URL="https://s3.amazonaws.com/php-lp/apache-$APACHE_VERSION.tar.gz"
APACHE_URL="https://s3.amazonaws.com/ngson2000/apache-$APACHE_VERSION.tar.gz"
echo "-----> Bundling Apache version $APACHE_VERSION"
curl --silent --max-time 60 --location "$APACHE_URL" | tar xz

PHP_URL="https://s3.amazonaws.com/php-lp/php-$PHP_VERSION.tar.gz"
PHP_URL="https://s3.amazonaws.com/ngson2000/php-$PHP_VERSION.tar.gz"
echo "-----> Bundling PHP version $PHP_VERSION"
curl --silent --max-time 60 --location "$PHP_URL" | tar xz

Expand All @@ -46,6 +46,9 @@ cp $LP_DIR/conf/php.ini php
mkdir -p bin
ln -s /app/php/bin/php bin/php

# create mahara data folder
mkdir -p /maharadata

cat >>boot.sh <<EOF
for var in \`env|cut -f1 -d=\`; do
echo "PassEnv \$var" >> /app/apache/conf/httpd.conf;
Expand Down
4 changes: 2 additions & 2 deletions conf/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ServerName 127.0.0.1
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/app/www"
DocumentRoot "/app/www/htdocs"

#
# Each directory to which Apache has access can be configured with respect
Expand All @@ -133,7 +133,7 @@ DocumentRoot "/app/www"
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/app/www">
<Directory "/app/www/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
Expand Down

0 comments on commit c10be06

Please sign in to comment.