-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e77eed
commit a9a18a5
Showing
16 changed files
with
1,127 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
configure_option "--with-mysql" "mysqlnd" | ||
configure_option "--with-mcrypt" "/usr" | ||
configure_option "--without-pear" | ||
configure_option "--with-curl" | ||
configure_option "--with-gd" | ||
configure_option "--with-enchant" "/usr" | ||
configure_option "--with-gettext" "/usr" | ||
configure_option "--with-gmp" "/usr" | ||
configure_option "--with-kerberos" | ||
configure_option "--with-imap-ssl=yes" | ||
configure_option "--with-imap=shared" | ||
configure_option "--with-ldap" "/usr" | ||
configure_option "--with-ldap-sasl" | ||
configure_option "--with-openssl-dir" "/usr" | ||
configure_option "--with-png-dir" "/usr" | ||
configure_option "--with-jpeg-dir" "/usr" | ||
configure_option "--with-pgsql" | ||
configure_option "--with-pdo-pgsql" | ||
configure_option "--with-pcre-regex" "/usr" | ||
configure_option "--with-pspell" "/usr" | ||
configure_option "--with-xpm-dir" "/usr" | ||
configure_option "--with-freetype-dir" "/usr" | ||
configure_option "--enable-zip" | ||
configure_option "--enable-ftp" | ||
configure_option "--enable-mbstring" | ||
|
||
configure_option -D "--enable-phpdbg" | ||
|
||
patch_file "php-5.3.29-64bit-intl.patch" | ||
patch_file "php-5.4.12-support-c++11.patch" | ||
patch_file "php-5.3.29-multi-sapi.patch" | ||
|
||
install_package "https://secure.php.net/distributions/php-5.3.29.tar.bz2" | ||
install_xdebug "2.2.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<FilesMatch ".+\.ph(ar|p|tml)$"> | ||
SetHandler application/x-httpd-php | ||
</FilesMatch> | ||
<FilesMatch ".+\.phps$"> | ||
SetHandler application/x-httpd-php-source | ||
# Deny access to raw php sources by default | ||
# To re-enable it's recommended to enable access to the files | ||
# only in specific virtual host or directory | ||
Require all denied | ||
</FilesMatch> | ||
# Deny access to files without filename (e.g. '.php') | ||
<FilesMatch "^\.ph(ar|p|ps|tml)$"> | ||
Require all denied | ||
</FilesMatch> | ||
|
||
# Running PHP scripts in user directories is disabled by default | ||
# | ||
# To re-enable PHP in user directories comment the following lines | ||
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it | ||
# prevents .htaccess files from disabling it. | ||
<IfModule mod_userdir.c> | ||
<Directory /home/*/public_html> | ||
php_admin_flag engine Off | ||
</Directory> | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
setup_phpbuild() { | ||
echo "::group::phpbuild" | ||
( | ||
cd ~ || exit | ||
git clone git://github.com/php-build/php-build | ||
cd php-build || exit | ||
sudo ./install.sh | ||
) | ||
sudo cp .github/scripts/5.3 /usr/local/share/php-build/definitions/ | ||
sudo cp .github/scripts/php-5.3.29-multi-sapi.patch /usr/local/share/php-build/patches/ | ||
cp /usr/local/share/php-build/default_configure_options /usr/local/share/php-build/default_configure_options.bak | ||
echo "::endgroup::" | ||
} | ||
|
||
setup_pear() { | ||
echo "::group::pear" | ||
sudo rm -rf "$install_dir"/bin/pear "$install_dir"/bin/pecl | ||
sudo curl -fsSL --retry "$tries" -o /usr/local/ssl/cert.pem https://curl.haxx.se/ca/cacert.pem | ||
sudo curl -fsSL --retry "$tries" -O https://github.com/pear/pearweb_phars/raw/v1.9.7/go-pear.phar | ||
sudo chmod a+x .github/scripts/install-pear.expect | ||
.github/scripts/install-pear.expect "$install_dir" | ||
rm go-pear.phar | ||
sudo "$install_dir"/bin/pear config-set php_ini "$install_dir"/etc/php.ini system | ||
sudo "$install_dir"/bin/pear channel-update pear.php.net | ||
echo "::endgroup::" | ||
} | ||
|
||
build_embed() { | ||
echo "::group::embed" | ||
cp /usr/local/share/php-build/default_configure_options.bak /usr/local/share/php-build/default_configure_options | ||
sudo sed -i "/apxs2/d" /usr/local/share/php-build/definitions/"$PHP_VERSION" || true | ||
sudo sed -i "/fpm/d" /usr/local/share/php-build/default_configure_options || true | ||
sudo sed -i "/cgi/d" /usr/local/share/php-build/default_configure_options || true | ||
echo "--enable-embed=shared" | sudo tee -a /usr/local/share/php-build/default_configure_options >/dev/null 2>&1 | ||
build_php | ||
mv "$install_dir" "$install_dir-embed" | ||
echo "::endgroup::" | ||
} | ||
|
||
build_apache_fpm() { | ||
echo "::group::apachefpm" | ||
export PHP_BUILD_APXS="/usr/bin/apxs2" | ||
cp /usr/local/share/php-build/default_configure_options.bak /usr/local/share/php-build/default_configure_options | ||
sudo mkdir -p "$install_dir" "$install_dir"/etc/apache2/mods-available /usr/local/ssl /var/lib/apache2 /run/php/ | ||
sudo chmod -R 777 /usr/local/php /usr/local/ssl /usr/include/apache2 /usr/lib/apache2 /etc/apache2/ /var/lib/apache2 /var/log/apache2 | ||
sudo sed -i "/cgi/d" /usr/local/share/php-build/default_configure_options | ||
sudo sed -i '1iconfigure_option "--with-apxs2" "/usr/bin/apxs2"' /usr/local/share/php-build/definitions/"$PHP_VERSION" | ||
echo "--enable-cgi" | sudo tee -a /usr/local/share/php-build/default_configure_options >/dev/null 2>&1 | ||
echo "--enable-fpm" | sudo tee -a /usr/local/share/php-build/default_configure_options >/dev/null 2>&1 | ||
echo "--with-fpm-user=www-data" | sudo tee -a /usr/local/share/php-build/default_configure_options >/dev/null 2>&1 | ||
echo "--with-fpm-group=www-data" | sudo tee -a /usr/local/share/php-build/default_configure_options >/dev/null 2>&1 | ||
build_php | ||
sudo ln -sv "$install_dir"/sbin/php-fpm "$install_dir"/bin/php-fpm | ||
sudo mkdir -p "$install_dir"/etc/systemd/system | ||
sudo sed -Ei "s|^listen = .*|listen = /run/php/php$PHP_VERSION-fpm.sock|" "$install_dir"/etc/php-fpm.conf | ||
sudo sed -Ei 's|;listen.owner.*|listen.owner = www-data|' "$install_dir"/etc/php-fpm.conf | ||
sudo sed -Ei 's|;listen.group.*|listen.group = www-data|' "$install_dir"/etc/php-fpm.conf | ||
sudo sed -Ei 's|;listen.mode.*|listen.mode = 0660|' "$install_dir"/etc/php-fpm.conf | ||
sudo sed -Ei "s|;pid.*|pid = /run/php/php$PHP_VERSION-fpm.pid|" "$install_dir"/etc/php-fpm.conf | ||
sudo sed -Ei "s|;error_log.*|error_log = /var/log/php$PHP_VERSION-fpm.log|" "$install_dir"/etc/php-fpm.conf | ||
sudo cp -fp .github/scripts/fpm.service "$install_dir"/etc/systemd/system/php-fpm.service | ||
sudo cp -fp .github/scripts/php-fpm-socket-helper "$install_dir"/bin/ | ||
sudo chmod a+x "$install_dir"/bin/php-fpm-socket-helper | ||
sudo mv "$install_dir/usr/lib/apache2/modules/libphp5.so" "$install_dir/usr/lib/apache2/modules/libphp5.3.so" | ||
echo "LoadModule php5_module $install_dir/usr/lib/apache2/modules/libphp5.3.so" | sudo tee /etc/apache2/mods-available/php5.3.load >/dev/null 2>&1 | ||
echo "LoadModule php5_module $install_dir/usr/lib/apache2/modules/libphp5.3.so" | sudo tee "$install_dir"/etc/apache2/mods-available/php5.3.load >/dev/null 2>&1 | ||
sudo cp -fp .github/scripts/apache.conf /etc/apache2/mods-available/php"$PHP_VERSION".conf | ||
sudo cp -fp .github/scripts/apache.conf "$install_dir"/etc/apache2/mods-available/php"$PHP_VERSION".conf | ||
sudo a2dismod php5 || true | ||
sudo mkdir -p /lib/systemd/system | ||
sudo mv "$install_dir"/etc/init.d/php-fpm "$install_dir"/etc/init.d/php"$PHP_VERSION"-fpm | ||
sudo sed -Ei "s|php-fpm.pid|php$PHP_VERSION-fpm.pid|" "$install_dir"/etc/init.d/php"$PHP_VERSION"-fpm | ||
sudo cp -fp "$install_dir"/etc/init.d/php"$PHP_VERSION"-fpm /etc/init.d/php"$PHP_VERSION"-fpm | ||
sudo cp -fp "$install_dir"/etc/systemd/system/php-fpm.service /lib/systemd/system/php"$PHP_VERSION"-fpm.service | ||
sudo /etc/init.d/php"$PHP_VERSION"-fpm start | ||
mv "$install_dir" "$install_dir-fpm" | ||
echo "::endgroup::" | ||
} | ||
|
||
build_php() { | ||
if ! php-build -v -i production "$PHP_VERSION" "$install_dir"; then | ||
echo 'Failed to build PHP' | ||
exit 1 | ||
fi | ||
} | ||
|
||
merge_sapi() { | ||
mv "$install_dir-fpm" "$install_dir" | ||
cp "$install_dir-embed/lib/libphp5.so" "$install_dir/lib/" | ||
cp -a "$install_dir-embed/include/php/sapi" "$install_dir/include/php" | ||
} | ||
|
||
configure_php() { | ||
sudo chmod 777 "$install_dir"/etc/php.ini | ||
( | ||
echo "date.timezone=UTC" | ||
echo "memory_limit=-1" | ||
) >>"$install_dir"/etc/php.ini | ||
setup_pear | ||
sudo ln -sf "$install_dir"/bin/* /usr/bin/ | ||
sudo ln -sf "$install_dir"/etc/php.ini /etc/php.ini | ||
} | ||
|
||
build_extensions() { | ||
chmod a+x .github/scripts/build_extensions.sh | ||
bash .github/scripts/build_extensions.sh | ||
} | ||
|
||
build_and_ship_package() { | ||
cd "$install_dir"/.. || exit | ||
tar -czf php53.tar.gz "$PHP_VERSION" | ||
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php53.tar.gz || true | ||
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T php53.tar.gz https://api.bintray.com/content/shivammathur/php/5.3-linux/5.3/php53.tar.gz || true | ||
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/5.3-linux/5.3/publish || true | ||
} | ||
|
||
install_dir=/usr/local/php/"$PHP_VERSION" | ||
tries=10 | ||
sudo mkdir -p "$install_dir" /usr/local/ssl | ||
sudo chmod -R 777 /usr/local/php /usr/local/ssl | ||
setup_phpbuild | ||
build_embed | ||
build_apache_fpm | ||
merge_sapi | ||
configure_php | ||
build_extensions | ||
build_and_ship_package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
install_pkg() { | ||
pkg_dir=$1 | ||
( | ||
cd "$pkg_dir" || exit 1 | ||
sudo ./configure --prefix=/usr | ||
sudo make -j"$(nproc)" | ||
sudo make install | ||
) | ||
} | ||
|
||
add_autoconf() { | ||
curl -o /tmp/autoconf.tar.gz -sL https://ftp.gnu.org/gnu/autoconf/autoconf-2.59.tar.gz | ||
tar -xzf /tmp/autoconf.tar.gz -C /tmp | ||
install_pkg /tmp/autoconf-2.59 | ||
} | ||
|
||
add_icu() { | ||
curl -o /tmp/icu.tgz -sL https://github.com/unicode-org/icu/releases/download/release-52-2/icu4c-52_2-src.tgz | ||
tar -xzf /tmp/icu.tgz -C /tmp | ||
install_pkg /tmp/icu/source | ||
} | ||
|
||
add_bison() { | ||
curl -o /tmp/bison.tar.gz -sL https://ftp.gnu.org/gnu/bison/bison-1.75.tar.gz | ||
tar -xzf /tmp/bison.tar.gz -C /tmp | ||
install_pkg /tmp/bison-1.75 | ||
} | ||
|
||
add_openssl() { | ||
curl -o /tmp/openssl.tar.gz -sL https://www.openssl.org/source/openssl-1.0.2u.tar.gz | ||
tar -xzf /tmp/openssl.tar.gz -C /tmp | ||
( | ||
cd /tmp/openssl-1.0.2u || exit 1 | ||
./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib/openssl-1.0 shared zlib-dynamic | ||
make depend | ||
sudo make -j"$(nproc)" | ||
sudo make install | ||
) | ||
} | ||
|
||
add_autoconf | ||
add_icu | ||
add_bison | ||
add_openssl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
build_extension() { | ||
extension=$1 | ||
source_dir=$2 | ||
shift 2 | ||
args=("$@") | ||
echo "::group::$extension" | ||
( | ||
cd "$source_dir" || exit | ||
phpize | ||
sudo ./configure "${args[@]}" --with-php-config="$install_dir"/bin/php-config | ||
sudo make -j"$(nproc)" | ||
sudo cp ./modules/"$extension".so "$ext_dir"/"$extension".so | ||
) | ||
echo "::endgroup::" | ||
} | ||
|
||
build_lib() { | ||
lib=$1 | ||
source_dir=$2 | ||
shift 2 | ||
args=("$@") | ||
echo "::group::$lib" | ||
mkdir "$install_dir"/lib/"$lib" | ||
( | ||
cd "$source_dir" || exit | ||
sudo ./configure --prefix="$install_dir"/lib/"$lib" "${args[@]}" | ||
sudo make -j"$(nproc)" | ||
sudo make install | ||
) | ||
echo "::endgroup::" | ||
} | ||
|
||
add_autoconf() { | ||
curl -o /tmp/autoconf.tar.gz -sL https://ftp.gnu.org/gnu/autoconf/autoconf-"$AUTOCONF_VERSION".tar.gz | ||
tar -xzf /tmp/autoconf.tar.gz -C /tmp | ||
echo "::group::autoconf" | ||
( | ||
cd /tmp/autoconf-"$AUTOCONF_VERSION" || exit 1 | ||
sudo ./configure --prefix=/usr | ||
sudo make -j"$(nproc)" | ||
sudo make install | ||
) | ||
echo "::endgroup::" | ||
} | ||
|
||
add_librabbitmq() { | ||
curl -o /tmp/rabbitmq.tar.gz -sL https://github.com/alanxz/rabbitmq-c/releases/download/v"$LIBRABBITMQ_VERSION"/rabbitmq-c-"$LIBRABBITMQ_VERSION".tar.gz | ||
tar -xzf /tmp/rabbitmq.tar.gz -C /tmp | ||
build_lib librabbitmq /tmp/rabbitmq-c-"$LIBRABBITMQ_VERSION" | ||
} | ||
|
||
add_libmemcached() { | ||
curl -o /tmp/memcached.tar.gz -sL https://launchpad.net/libmemcached/1.0/"$LIBMEMCACHED_VERSION"/+download/libmemcached-"$LIBMEMCACHED_VERSION".tar.gz | ||
tar -xzf /tmp/memcached.tar.gz -C /tmp | ||
build_lib libmemcached /tmp/libmemcached-"$LIBMEMCACHED_VERSION" | ||
} | ||
|
||
add_amqp() { | ||
add_librabbitmq | ||
curl -o /tmp/amqp.tgz -sL https://pecl.php.net/get/amqp-"$AMQP_VERSION".tgz | ||
tar -xzf /tmp/amqp.tgz -C /tmp | ||
build_extension amqp /tmp/amqp-"$AMQP_VERSION" --with-amqp=shared --with-librabbitmq-dir="$install_dir"/lib/librabbitmq | ||
} | ||
|
||
add_memcached() { | ||
add_libmemcached | ||
curl -o /tmp/memcached.tgz -sL https://pecl.php.net/get/memcached-"$MEMCACHED_VERSION".tgz | ||
tar -xzf /tmp/memcached.tgz -C /tmp | ||
build_extension memcached /tmp/memcached-"$MEMCACHED_VERSION" --enable-memcached --with-libmemcached-dir="$install_dir"/lib/libmemcached | ||
} | ||
|
||
add_memcache() { | ||
curl -o /tmp/memcache.tgz -sL https://pecl.php.net/get/memcache-"$MEMCACHE_VERSION".tgz | ||
tar -xzf /tmp/memcache.tgz -C /tmp | ||
build_extension memcache /tmp/memcache-"$MEMCACHE_VERSION" --enable-memcache | ||
} | ||
|
||
add_mongodb() { | ||
curl -o /tmp/mongodb.tgz -sL https://pecl.php.net/get/mongodb-"$MONGODB_VERSION".tgz | ||
tar -xzf /tmp/mongodb.tgz -C /tmp | ||
build_extension mongodb /tmp/mongodb-"$MONGODB_VERSION" --enable-mongodb | ||
} | ||
|
||
add_redis() { | ||
curl -o /tmp/redis.tgz -sL https://pecl.php.net/get/redis-"$REDIS_VERSION".tgz | ||
tar -xzf /tmp/redis.tgz -C /tmp | ||
build_extension redis /tmp/redis-"$REDIS_VERSION" --enable-redis | ||
} | ||
|
||
AUTOCONF_VERSION='2.68' | ||
PHP_VERSION='5.3' | ||
AMQP_VERSION='1.9.3' | ||
MEMCACHED_VERSION='2.2.0' | ||
MEMCACHE_VERSION='3.0.8' | ||
MONGODB_VERSION='1.1.0' | ||
REDIS_VERSION='2.2.8' | ||
LIBMEMCACHED_VERSION='1.0.18' | ||
LIBRABBITMQ_VERSION='0.8.0' | ||
install_dir=/usr/local/php/"$PHP_VERSION" | ||
ext_dir=$("$install_dir"/bin/php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||") | ||
add_autoconf | ||
add_amqp | ||
add_memcached | ||
add_memcache | ||
add_mongodb | ||
add_redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=The PHP 5.3 FastCGI Process Manager | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/bin/php-fpm --nodaemonize --fpm-config /usr/local/php/5.3/etc/php-fpm.conf | ||
ExecStartPost=-/usr/local/php/5.3/bin/php-fpm-socket-helper install /run/php/php-fpm.sock /usr/local/php/5.3/etc/php-fpm.d/www.conf 53 | ||
ExecStopPost=-/usr/local/php/5.3/bin/php-fpm-socket-helper remove /run/php/php-fpm.sock /usr/local/php/5.3/etc/php-fpm.d/www.conf 53 | ||
ExecReload=/bin/kill -USR2 $MAINPID | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env expect | ||
|
||
set send_slow {1 .1} | ||
set timeout -1 | ||
set path [lindex $argv 0]; | ||
|
||
spawn "$path/bin/php" go-pear.phar | ||
|
||
expect -re "1-\[0-9]+, 'all' or Enter to continue:" | ||
sleep .1 | ||
send -s -- "1\r" | ||
|
||
expect -re "Installation base (.*):" | ||
sleep .1 | ||
send -s -- "$path\r" | ||
|
||
expect -re "1-\[0-9]+, 'all' or Enter to continue:" | ||
sleep .1 | ||
send -s -- "\r" | ||
|
||
expect -re "Would you like to alter php.ini(.*):" | ||
sleep .1 | ||
send -s -- "\r" | ||
|
||
expect "Press Enter to continue:" | ||
sleep .1 | ||
send -s -- "\r" | ||
expect EOF |
Oops, something went wrong.