Initial import
This commit is contained in:
216
old-versions/mod_php_5.2_apache-2.2_install.sh
Executable file
216
old-versions/mod_php_5.2_apache-2.2_install.sh
Executable file
@@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# php ( fuer Apache 2 )
|
||||
#
|
||||
VERSION=5.2.17
|
||||
APACHE_VERSION=2.2.29
|
||||
APACHE_BASEDIR=/usr/local/httpd-${APACHE_VERSION}_php-${VERSION}
|
||||
APXS=${APACHE_BASEDIR}/bin/apxs
|
||||
|
||||
PREFIX_PHP="/usr/local/php-$VERSION-httpd-${APACHE_VERSION}"
|
||||
|
||||
_srcdir=/usr/local/src/apache2
|
||||
_logdir=${_srcdir}/log_php-${VERSION}_http-${APACHE_VERSION}_build
|
||||
|
||||
_pwd=`pwd`
|
||||
_builddir=${_srcdir}/php-${VERSION}_http-${APACHE_VERSION}
|
||||
|
||||
mkdir -p $_logdir > /dev/null 2>&1
|
||||
|
||||
## --------------------------------------------------
|
||||
|
||||
## - get sources..
|
||||
## -
|
||||
cd $_srcdir
|
||||
|
||||
if [ ! -f ${_srcdir}/php-$VERSION.tar.bz2 ]; then
|
||||
wget http://museum.php.net/php5/php-$VERSION.tar.bz2
|
||||
fi
|
||||
|
||||
|
||||
bunzip2 < ${_srcdir}/php-$VERSION.tar.bz2 | tar -xf - || exit 1
|
||||
chown -R root.root php-$VERSION || exit 1
|
||||
mv php-$VERSION $_builddir
|
||||
cd $_builddir || exit 1
|
||||
|
||||
echo -e "\n\tgoing to configure.."
|
||||
echo -e "\t(see ${_logdir}/php-configure.log for more details)"
|
||||
|
||||
|
||||
# : ${_arch:=i686}
|
||||
# : ${_arch:=athlon}
|
||||
: ${_arch:=k8} ## --> x86-64 instructionset
|
||||
|
||||
##_cflags="-O2 -march=$_arch "
|
||||
|
||||
## - LDFLAGS="-s" --> Remove all symbol table and relocation information from the executable.
|
||||
## F77="/usr/bin/g77-3.4" \
|
||||
## CXXCPP="/usr/bin/g++-3.4 -E" \
|
||||
## CC="/usr/bin/gcc-3.4" \
|
||||
## CXX="/usr/bin/g++-3.4" \
|
||||
## CPP="/usr/bin/cpp-3.4" \
|
||||
## CFLAGS="$_cflags" LDFLAGS="-s" \
|
||||
CFLAGS="-fPIC" \
|
||||
LDFLAGS="-s" \
|
||||
./configure \
|
||||
--prefix=$PREFIX_PHP \
|
||||
--with-apxs2=$APXS \
|
||||
--with-gd \
|
||||
--with-config-file-path=${APACHE_BASEDIR}/conf \
|
||||
--with-mysql=/usr/local/mysql \
|
||||
--with-mysqli=/usr/local/mysql/bin/mysql_config \
|
||||
--with-pdo-mysql=/usr/local/mysql \
|
||||
--with-mysql-sock \
|
||||
--with-pgsql \
|
||||
--with-regex=system \
|
||||
--enable-wddx \
|
||||
--enable-exif \
|
||||
--with-zlib \
|
||||
--with-gdbm \
|
||||
--with-openssl=/usr/local/openssl-0.9.8y \
|
||||
--with-jpeg-dir \
|
||||
--with-png-dir \
|
||||
--with-curl \
|
||||
--enable-dba \
|
||||
--with-mcrypt \
|
||||
--with-xpm-dir \
|
||||
--with-t1lib \
|
||||
--with-freetype-dir \
|
||||
--enable-ftp \
|
||||
--with-readline \
|
||||
--enable-sockets \
|
||||
--with-imap-ssl \
|
||||
--with-kerberos \
|
||||
--with-gettext \
|
||||
--enable-soap \
|
||||
--enable-mbstring \
|
||||
--enable-zip \
|
||||
--enable-calendar \
|
||||
--enable-bcmath \
|
||||
--with-bz2 \
|
||||
--enable-shmop \
|
||||
--enable-sysvmsg \
|
||||
--enable-sysvsem \
|
||||
--enable-sysvshm \
|
||||
> ${_logdir}/php-configure.log 2>&1 || exit 1
|
||||
|
||||
|
||||
## --with-mm \ # does not work with apache v2.4
|
||||
|
||||
## --with-pgsql=/usr/local/pgsql \
|
||||
## --with-mysql \
|
||||
## --with-mysql \
|
||||
## --with-mysqli \
|
||||
## --with-pdo-mysql \
|
||||
|
||||
## --with-openssl=/usr/local/openssl-0.9.8y \
|
||||
|
||||
## --enable-force-cgi-redirect \
|
||||
## --enable-track-vars \
|
||||
## --with-tiff-dir \
|
||||
## --with-ttf \
|
||||
## --with-memcache \
|
||||
## --with-xml \
|
||||
|
||||
echo -e "\n\tgoing to compile.."
|
||||
echo -e "\t(see ${_logdir}/php-make.log for more details)"
|
||||
make > ${_logdir}/php-make.log 2>&1 || exit 1
|
||||
|
||||
echo -e "\n\tgoing to install.."
|
||||
echo -e "\t(see ${_logdir}/php-make_install.log for more details)"
|
||||
make install > ${_logdir}/php-make_install.log 2>&1 || exit 1
|
||||
|
||||
#cp php.ini-dist ${APACHE_BASEDIR}/conf/php.ini || exit 1
|
||||
[ -f ${APACHE_BASEDIR}/conf/php.ini ] && cp -a ${APACHE_BASEDIR}/conf/php.ini ${APACHE_BASEDIR}/conf/php.ini-`date +"%Y-%m-%d-%H%M"`
|
||||
cp php.ini-dist ${APACHE_BASEDIR}/conf/php.ini || exit 1
|
||||
|
||||
_set_php_entries=""
|
||||
echo ""
|
||||
echo -n "do you want to set \"LoadModule\" entries in httpd.conf ? [y/n]: "
|
||||
read _set_php_entries
|
||||
if [ "y" = "$_set_php_entries" -o "Y" = "$_set_php_entries" -o "Yes" = "$_set_php_entries" -o "yes" = "$_set_php_entries" ];then
|
||||
sed -i -r \
|
||||
-e "s&(^\s*LoadModule php5_module.*$)&\1\n#<IfModule mod_php5.c>\n AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml\n AddType application/x-httpd-php-source .phps\n#</IfModule>&" ${APACHE_BASEDIR}/conf/httpd.conf
|
||||
#-e "s&(^\s*LoadModule php5_module.*$)&\1\n<IfModule mod_php5.c>\n AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml\n AddType application/x-httpd-php-source .phps\n</IfModule>&" ${APACHE_BASEDIR}/conf/httpd.conf
|
||||
fi
|
||||
|
||||
_set_link=""
|
||||
echo
|
||||
echo -n "do you want to set symlink /usr/local/php -> `basename $PREFIX_PHP` ? [y/n]: "
|
||||
read _set_link
|
||||
if [ "y" = "$_set_link" -o "Y" = "$_set_link" -o "Yes" = "$_set_link" -o "yes" = "$_set_link" ];then
|
||||
if [ -L /usr/local/php ];then
|
||||
rm -f /usr/local/php
|
||||
fi
|
||||
ln -s `basename $PREFIX_PHP` /usr/local/php
|
||||
fi
|
||||
|
||||
## - special for debian. set manpath entries
|
||||
## -
|
||||
if [ -f /etc/manpath.config ];then
|
||||
if ! grep /usr/local/php/man /etc/manpath.config > /dev/null 2<&1 ; then
|
||||
echo >> /etc/manpath.config
|
||||
echo "MANDATORY_MANPATH /usr/local/php/man /var/cache/man" >> /etc/manpath.config
|
||||
echo "MANPATH_MAP /usr/local/php/bin /usr/local/php/man" >> /etc/manpath.config
|
||||
echo "MANDB_MAP /usr/local/php/man /var/cache/man" >> /etc/manpath.config
|
||||
fi
|
||||
elif [ -f /etc/man.conf];then
|
||||
if ! grep /opt/php/man /etc/man.conf > /dev/null 2<&1 ; then
|
||||
echo >> /etc/man.conf
|
||||
echo "MANPATH /opt/php/man /var/cache/man" >> /etc/man.conf
|
||||
echo "MANPATH_MAP /opt/php/bin /opt/php/man" >> /etc/man.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
cd $pwd
|
||||
|
||||
cat<<EOF
|
||||
|
||||
php.ini
|
||||
=======
|
||||
|
||||
You may edit your php.ini file at ${APACHE_BASEDIR}/conf
|
||||
to set PHP options.
|
||||
|
||||
|
||||
httpd.conf
|
||||
=========
|
||||
|
||||
|
||||
1. Edit your httpd.conf to load the PHP module. The path on the right hand
|
||||
side of the LoadModule statement must point to the path of the PHP
|
||||
module on your system. The make install from above may have already
|
||||
added this for you, but be sure to check.
|
||||
|
||||
For PHP 5:
|
||||
LoadModule php5_module libexec/libphp5.so
|
||||
|
||||
I will hope, this is already done
|
||||
|
||||
|
||||
2. Tell Apache to parse certain extensions as PHP. For example,
|
||||
let's have Apache parse the .php extension as PHP. You could
|
||||
have any extension(s) parse as PHP by simply adding more, with
|
||||
each separated by a space. We'll add .phtml to demonstrate.
|
||||
|
||||
AddType application/x-httpd-php .php .phtml
|
||||
|
||||
It's also common to setup the .phps extension to show highlighted PHP
|
||||
source, this can be done with:
|
||||
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
or much better:
|
||||
|
||||
|
||||
<IfModule mod_php5.c>
|
||||
AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml
|
||||
AddType application/x-httpd-php-source .phps
|
||||
</IfModule>
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user