Last active
October 10, 2015 18:07
-
-
Save jgskin/3730105 to your computer and use it in GitHub Desktop.
php install ubuntu 12.10
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
#! /usr/bin/python | |
""" PHP install script. Tested with ubuntu 12.10/14.04""" | |
import os | |
import argparse | |
parser = argparse.ArgumentParser(description='...') | |
parser.add_argument('prefix', nargs='?', default=False) | |
args = parser.parse_args() | |
prefix = args.prefix | |
ubuntu_packs = [ | |
"mysql-server", | |
"mysql-client", | |
"libxml2-dev", | |
"libicu-dev", | |
"g++", | |
"libzzip-dev", | |
"libcurl4-nss-dev", | |
"libcurl4-openssl-dev", | |
"libreadline6-dev", | |
"autoconf", | |
"libgd2-xpm-dev", | |
] | |
php_opts = [ | |
"enable-ftp", | |
"enable-mbstring", | |
"enable-intl", | |
"enable-pcntl", | |
"with-mysql", | |
"with-pdo-mysql", | |
"with-openssl", | |
"with-zlib", | |
"enable-zip", | |
"with-curl", | |
"with-readline", | |
"enable-maintainer-zts", | |
"enable-bcmath", | |
"with-gd", | |
"with-jpeg-dir=/usr/lib", | |
"with-png-dir=/usr/lib", | |
"with-xpm-dir=/usr/lib", | |
"with-zlib-dir", | |
] | |
if prefix: | |
php_opts.append("prefix={0}".format(prefix)) | |
# install ubuntu packs | |
for packname in ubuntu_packs: | |
os.system("sudo apt-get -y install {0}".format(packname)) | |
# configure PHP | |
os.system("./configure " + " ".join(["--" + opt for opt in php_opts])) | |
# build and install PHP | |
os.system(""" | |
make | |
sudo make install | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment