This is a build pack bundling PHP and Apache for Heroku apps.
The config files are bundled with the build pack itself:
- conf/httpd.conf
- conf/php.ini
On a Heroku Dyno, one can run the following as executable text. After
running it, /app
will contain, among other entities,
apache-2.2.25-1.tar.gz
, php-5.3.27-1.tar.gz
, and
mcrypt-2.5.8-1.tar.gz
which should be uploaded to a location that
can be downloaded by the build pack (see the URIs in compile
).
To compile after making updates, do the following:
-
clone the repo of our heroku app used for building build pack dependencies: git@heroku.com:temporary-php-builder.git
-
copy/paste the script below over build_php.sh within that repository
-
git push to deploy the updated script
-
heroku run bash --app temporary-php-builder
-
cd www
-
chmod 775 ./build_php.sh
-
./build_php
-
sftp iron@thirdiron.com and put the files on our server for easy upload to S3
#!/bin/bash set -uex cd /tmp
heroku_rev='-4'
find /app -mindepth 1 -print0 | xargs -0 rm -rf
mcrypt_version=2.5.8 mcrypt_dirname=libmcrypt-$mcrypt_version mcrypt_archive_name=$mcrypt_dirname.tar.bz2
if [ ! -f mcrypt_archive_name ] then curl -Lo $mcrypt_archive_name http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download fi
rm -rf $mcrypt_dirname tar jxf $mcrypt_archive_name
pushd $mcrypt_dirname ./configure --prefix=/app/vendor/mcrypt
--disable-posix-threads --enable-dynamic-loading make -s make install -s popdhttpd_version=2.2.25 httpd_dirname=httpd-$httpd_version httpd_archive_name=$httpd_dirname.tar.bz2
if [ ! -f $httpd_archive_name ] then curl -LO http://mirrors.axint.net/apache/httpd/$httpd_archive_name fi
rm -rf $httpd_dirname tar jxf $httpd_archive_name
pushd $httpd_dirname ./configure --prefix=/app/apache --enable-rewrite --with-included-apr make -s make install -s popd
php_version=5.3.27 php_dirname=php-$php_version php_archive_name=$php_dirname.tar.bz2
if [ ! -f $php_archive_name ] then curl -Lo $php_archive_name http://us1.php.net/get/php-5.3.27.tar.bz2/from/www.php.net/mirror fi
rm -rf $php_dirname tar jxf $php_archive_name
pushd $php_dirname ./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-openssl --with-mcrypt=/app/vendor/mcrypt --enable-sockets
--enable-zip
--enable-mbstring make -s make install -s popdmkdir -p /app/php/lib/php cp /usr/lib/libmysqlclient.so.16 /app/php/lib/php
export PATH=/app/php/bin:$PATH /app/php/bin/pecl channel-update pecl.php.net
yes '' | /app/php/bin/pecl install apc
find /app/apache/cgi-bin/ -mindepth 1 -print0 | xargs -0 rm -r
pushd /app echo $mcrypt_version > vendor/mcrypt/VERSION tar -zcf mcrypt-"$mcrypt_version""$heroku_rev".tar.gz vendor/mcrypt echo $httpd_version > apache/VERSION tar -zcf apache-"$httpd_version""$heroku_rev".tar.gz apache echo $php_version > php/VERSION tar -zcf php-"$php_version""$heroku_rev".tar.gz php popd
To change this buildpack, fork it on Github. Push up changes to your fork, then create a test app with --buildpack and push to it.
Created by Pedro Belo. Many thanks to Keith Rarick for the help with assorted Unix topics :)