Initial import

This commit is contained in:
Christoph 2017-02-21 02:05:25 +01:00
commit 21085f6b7d
17 changed files with 8689 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/BAK/*
log_*

15
DOC/README.php5.2-install Normal file
View File

@ -0,0 +1,15 @@
## - if you get the following error:
## -
## - configure: error: libXpm.(a|so) not found
## -
## - set a symlink /usr/lib/libXpm.a --> /usr/lib/x86_64-linux-gnu/libXpm.a
## -
ln -s x86_64-linux-gnu/libXpm.a /usr/lib/libXpm.a
## - or (the same)
ln -s /usr/lib/x86_64-linux-gnu/libXpm.a /usr/lib/libXpm.a
ln -s x86_64-linux-gnu/libjpeg.a /usr/lib/libjpeg.a
ln -s x86_64-linux-gnu/libpng.a /usr/lib/libpng.a

42
DOC/README.php5.4-install Normal file
View File

@ -0,0 +1,42 @@
## - if you get the following error:
## -
## - configure: error: libXpm.(a|so) not found
## -
## - set a symlink /usr/lib/libXpm.a --> /usr/lib/x86_64-linux-gnu/libXpm.a
## -
ln -s x86_64-linux-gnu/libXpm.a /usr/lib/libXpm.a
## - or (the same)
ln -s /usr/lib/x86_64-linux-gnu/libXpm.a /usr/lib/libXpm.a
## - IMAP support
## -
## - if you get the following error:
## -
## - configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.
## - This should not happen. Check config.log for additional information.
## -
aptitude install libc-client-dev
## - or
apt-get install libc-client2007e libc-client2007e-dev libpam0g-dev mlock
## - ICU support (?)
## -
## - configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install
## - prefix and make sure icu-config works.
## -
apt-get install libicu-dev
## - PSPELL support
## -
## - configure: error: Cannot find pspell
## -
apt-get install libpspell-dev
## - VPX Codecs
# -
apt-get install libvpx-dev

8
DOC/README.php5.6.redis Normal file
View File

@ -0,0 +1,8 @@
## - Install redis extension under php 5.6
## -
## - Note: the actual version (at time 3.0) requires php vsersion >= 7.0
## - (and for now < 7.1)
## -
## - Note: On php 5.6.x install redis v. 2.2.8
## -
pecl install redis-2.2.8

14
DOC/README.php57.ldap Normal file
View File

@ -0,0 +1,14 @@
## - PHP does not find LDAP libraries:
## -
## - configure: error: Cannot find ldap libraries in /usr/lib
## -
## - FIX: set a symlink:
## - ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
## -
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
## - Note:
## -
## - If 'apr' and apr-utils' wasn't compiled with ldap support (that
## - is, if libldap.so wasn't present), recompile both

29
DOC/READNE.memcached Normal file
View File

@ -0,0 +1,29 @@
## ---
## - Installtion of PHP-Extension Memcached
## ---
## - Install extension memcached via pecl (pecl install memcached)
## -
## - Note: Installation my fail with error message:
## -
## - configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check
## -
## -
## - During installation answer with this:
## -
## - libmemcached directory [no] : no --disable-memcached-sasl
## - Install extension memcached directly and give configure option --disable-memcached-sasl
## -
## - --disable-memcached-sasl
## -
VERSION=2.2.0
wget https://pecl.php.net/get/memcached-${VERSION}.tgz
gunzip < memcached-${VERSION}.tgz | tar -xf -
cd memcached-${VERSION}
./configure --disable-memcached-sasl
make
make install

56
DOC/ffmpeg-php.INSTALL Normal file
View File

@ -0,0 +1,56 @@
## - install prerequisites
## -
apt-get install ffmpeg re2c libavcodec-dev libavformat-dev libswscale-dev libpostproc-dev
cd /usr/local/src/apache2
## - download ffmpeg-php from sourceforge
## -
## - http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/
## -
## - If configure script ends up in error
## -
## - configure: error: ffmpeg shared libraries not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option
## -
## - library libavcodec.so was not found.
## -
## - You can solve it, by symlinc libavcodec.so to directory /usr/lib
## -
cd /usr/lib
ln -s x86_64-linux-gnu/libavcodec.so
bunzip2 < ffmpeg-php-0.6.0.tar.bz2 | tar -xf -
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install
## - in file (/usr/local/apache2/conf/)php.ini add:
## - extension=ffmpeg.so
vim /usr/local/apache2/conf/php.ini
/etc/init.d/apache2 restart
## - Install fron source (svn)
#svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php_php-5.3.26
svn co https://svn.code.sf.net/p/ffmpeg-php/code ffmpeg--php_php-5.3.26
cd ffmpeg-php_php-5.4.26/trunk/ffmpeg-php
phpize
./configure --enable-shared
make
make install
## - in file (/usr/local/apache2/conf/)php.ini add:
## - extension=ffmpeg.so
vim /usr/local/apache2/conf/php.ini

24
DOC/php_pear_install.txt Normal file
View File

@ -0,0 +1,24 @@
PHP 5.3.18
==========
pear install Auth_SASL
pear install Console_Getopt
pear install HTTP
pear install HTTP_Request
pear install HTTP_Upload-beta
pear install Mail
pear install Mail_Mime
pear install Mail_mimeDecode
pear install Net_SMTP
PHP 5.4.9
=========
pear install Auth_SASL
pear install Console_Getopt
pear install HTTP
pear install HTTP_Request
pear install HTTP_Upload-beta
pear install Mail
pear install Mail_Mime
pear install Mail_mimeDecode
pear install Net_SMTP

14
DOC/php_pecl_install.txt Normal file
View File

@ -0,0 +1,14 @@
PHP 5.3.18
==========
pecl install pecl_http
pecl install apc
pecl install imagick
pecl install geoip
PHP 5.4.9
=========
pecl install pecl_http
pecl install apc
pecl install imagick-beta
pecl install geoip

2907
mod_php_install.sh Executable file

File diff suppressed because it is too large Load Diff

View 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

View File

@ -0,0 +1,215 @@
#!/usr/bin/env bash
# php ( fuer Apache 2 )
#
VERSION=5.2.17
APACHE_VERSION=2.4.10
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" \
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

View File

@ -0,0 +1,209 @@
#!/usr/bin/env bash
# php ( fuer Apache 2 )
#
VERSION=5.3.27
APACHE_VERSION=2.2.25
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://de.php.net/distributions/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" \
LDFLAGS="-s" \
./configure \
--prefix=$PREFIX_PHP \
--with-apxs2=$APXS \
--with-gd \
--with-config-file-path=${APACHE_BASEDIR}/conf \
--with-mysql \
--with-mysql-sock \
--with-mysqli \
--with-pdo-mysql \
--with-pgsql \
--with-regex=system \
--enable-wddx \
--enable-exif \
--with-zlib \
--with-openssl \
--with-gdbm \
--with-jpeg-dir \
--with-png-dir \
--with-curl \
--enable-dba \
--with-mcrypt \
--with-xpm-dir \
--with-t1lib \
--with-freetype-dir \
--enable-ftp \
--with-readline \
--with-mm \
--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-pgsql=/usr/local/pgsql \
## --with-mysql=/usr/local/mysql \
## --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-production ${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

View File

@ -0,0 +1,729 @@
#!/usr/bin/env bash
# php ( fuer Apache 2 )
#
VERSION=5.3.29
WITHOUT_APACHE_MOD_PHP=false
#WITHOUT_APACHE_MOD_PHP=true
APACHE_VERSION=2.4.12
APACHE_BASEDIR=/usr/local/httpd-${APACHE_VERSION}_php-${VERSION}
APXS=${APACHE_BASEDIR}/bin/apxs
_srcdir=/usr/local/src/apache2
_pwd=`pwd`
## --------------------------------------------------
## - Let make use multiple cores (-j<number of cores +1>)
## -
export MAKEFLAGS=-j$(expr `grep "^processor" /proc/cpuinfo | sort -u | wc -l` + 1)
## --- Some functions
## ---
echononl(){
echo X\\c > /tmp/shprompt$$
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
echo -e -n "$*\\c" 1>&2
else
echo -e -n "$*" 1>&2
fi
rm /tmp/shprompt$$
}
fatal(){
echo ""
echo -e "Fehler: $*"
echo ""
echo -e "\t\033[31m\033[1mInstalllation wird abgebrochen\033[m\033[m"
echo ""
exit 1
}
echo_ok() {
echo -e "\033[75G[ \033[1;32mok\033[m ]"
## echo -e " [ ok ]"
}
echo_failed(){
echo -e "\033[75G[ \033[1;31mfailed\033[m ]"
## echo -e " [ failed ]"
}
echo_skipped() {
echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]"
}
## ---
## --- END: functions
## --------------------------------------------------
if $WITHOUT_APACHE_MOD_PHP ; then
PREFIX_PHP=/usr/local/php-$VERSION
PHP_INI_FILE="${PREFIX_PHP}/etc/php.ini"
_builddir=${_srcdir}/php-${VERSION}
_logdir=${_srcdir}/log_php-${VERSION}_build
elif [ -n "$APACHE_VERSION" ]; then
PREFIX_PHP="/usr/local/php-$VERSION-httpd-${APACHE_VERSION}"
PHP_INI_FILE="${APACHE_BASEDIR}/conf/php.ini"
_builddir=${_srcdir}/php-${VERSION}_http-${APACHE_VERSION}
_logdir=${_srcdir}/log_php-${VERSION}_http-${APACHE_VERSION}_build
else
echo ""
echo -e "\t[ Error ]: I was requested to build php with apache mod_php module,"
echo -e "\t but environment \"APACHE_VERSION\" is unset."
echo ""
exit
fi
if [ -d "$_logdir" ];then
mv $_logdir $_logdir.`date +%Y%m%d-%H%M`
fi
mkdir -p $_logdir > /dev/null 2>&1
if [ -d "$_builddir" ];then
mv $_builddir $_builddir.`date +%Y%m%d-%H%M`
fi
if [ -d "$PREFIX_PHP" ];then
mv $PREFIX_PHP $PREFIX_PHP.`date +%Y%m%d-%H%M`
fi
## - get sources..
## -
cd $_srcdir
if [ ! -f ${_srcdir}/php-$VERSION.tar.bz2 ]; then
wget http://de.php.net/distributions/php-$VERSION.tar.bz2
fi
bunzip2 < ${_srcdir}/php-$VERSION.tar.bz2 | tar -xf - || exit 1
chown -R root.root php-$VERSION || exit 1
if ! $WITHOUT_APACHE_MOD_PHP ; then
mv php-$VERSION $_builddir
fi
cd $_builddir || exit 1
if [ "$VERSION" = "5.3.28" ]; then
echo -e "\n\tgoing to patch file \"Zend/zend_language_parser.y\" .."
if [ ! -f "${_srcdir}/bison_build_2a.patch" ]; then
fatal "Cannot find patch \"bison_build_2a.patch\" for Zend/zend_language_parser.y\n\t See: https://bugs.php.net/patch-display.php?bug_id=64503&patch=bison_build_2a.patch&revision=latest"
else
patch ${_builddir}/Zend/zend_language_parser.y ${_srcdir}/bison_build_2a.patch > /dev/null
fi
fi
echo -e "\n\tgoing to configure.."
echo -e "\t(see ${_logdir}/php-configure.log for more details)"
## - if you get the following error:
## -
## - configure: error: libXpm.(a|so) not found
## -
## - set a symlink /usr/lib/libXpm.a --> /usr/lib/x86_64-linux-gnu/libXpm.a
## -
if [ ! -h "/usr/lib/libXpm.a" -a ! -f "/usr/lib/libXpm.a" ];then
ln -s x86_64-linux-gnu/libXpm.a /usr/lib/libXpm.a
fi
if [ ! -h "/usr/lib/libjpeg.a" -a ! -f "/usr/lib/libjpeg.a" ];then
ln -s x86_64-linux-gnu/libjpeg.a /usr/lib/libjpeg.a
fi
if [ ! -h "/usr/lib/libXpm.a" -a ! -f "/usr/lib/libXpm.a" ];then
ln -s x86_64-linux-gnu/libpng.a /usr/lib/libpng.a
fi
# : ${_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" \
config_params="
--prefix=$PREFIX_PHP \
--with-gd \
--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-pdo-pgsql \
--with-regex=system \
--enable-wddx \
--enable-exif \
--with-zlib \
--with-openssl \
--with-gdbm \
--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 \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-pspell \
--enable-soap \
--enable-mbstring \
--enable-zip \
--enable-calendar \
--enable-bcmath \
--with-bz2 \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-cgi"
if $WITHOUT_APACHE_MOD_PHP ; then
config_params="$config_params --without-apxs2 --without-apxs --with-config-file-path=${PREFIX_PHP}/etc"
else
config_params="$config_params --with-apxs2=$APXS --with-config-file-path=${APACHE_BASEDIR}/conf"
fi
LDFLAGS="-s" \
./configure $config_params > ${_logdir}/php-configure.log 2>&1 || exit 1
## --with-mm \ # does not work with apache v2.4
## --with-pgsql=/usr/local/pgsql \
## --with-mysql=/usr/local/mysql \
## --with-mysqli=/usr/local/mysql/bin/mysql_config \
## --with-pdo-mysql=/usr/local/mysql \
## --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
if [ "$?" != "0" ]; then
make install > ${_logdir}/php-make_install.log 2>&1
if [ "$?" != "0" ]; then
echo -e "\n [ Warn ] make install returncode: $?"
echo " for safety:"
echo " # cd $_builddir"
echo " # make install"
fi
fi
echo -e "\n\tBasic installation complete..\n"
#cp php.ini-production $PHP_INI_FILE || exit 1
[ -f $PHP_INI_FILE ] && cp -a $PHP_INI_FILE ${PHP_INI_FILE}-`date +"%Y-%m-%d-%H%M"`
cp php.ini-production $PHP_INI_FILE || exit 1
if ! $WITHOUT_APACHE_MOD_PHP ; then
_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
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
## - Add /usr/local/php/bin to the systems PATH variable
## -
echononl "\tAdd `dirname $PREFIX_PHP`/php/bin to the systems PATH variable"
_checkdir=`dirname $PREFIX_PHP`/php/bin
if [ -f /etc/profile ]; then
if ! grep -e "$_checkdir" /etc/profile > /dev/null 2<&1 ; then
perl -i -n -p -e "s#^([ ]*export[ ]*PATH.*$)#check_dir=$_checkdir\nif [ -d \"\\\$check_dir\" ];then\n PATH=\\\${check_dir}:\\\$PATH\nfi\n\n\1#" /etc/profile > /dev/null 2<&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
if ! echo "$PATH" | grep $_checkdir > /dev/null 2>&1 ; then
export PATH=${_checkdir}:$PATH
fi
else
echo_skipped
fi
fi
echo ""
## -----
## - Install geoip
## -----
echononl "\tInstalling libgeoip1 libgeoip-dev geoip-bin .."
if ! dpkg -l libgeoip-dev | grep -e "^ii" | grep libgeoip-dev > /dev/null 2>&1 ; then
apt-get -q -y install libgeoip1 libgeoip-dev geoip-bin > /dev/null 2>&1
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
fi
else
echo_skipped
fi
echononl "\tInstall geoip via pecl.."
${PREFIX_PHP}/bin/pecl install geoip > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "\tphp.ini: extension=geoip.so .."
_extension="geoip.so"
perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## -----
## - END: Install geoip
## -----
## -----
## - Install APC
## -----
echononl "\tInstall APC via pecl.."
printf "\n" | ${PREFIX_PHP}/bin/pecl install apc > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "\tphp.ini: extension=APC .."
_extension="apc.so"
perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## -----
## - END: Install APC
## -----
## -----
## - Install intl
## -----
echononl "\tInstall intl via pecl.."
printf "\n" | ${PREFIX_PHP}/bin/pecl install intl > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "\tphp.ini: extension=intl .."
_extension="intl.so"
perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## -----
## - END: Install intl
## -----
## -----
## - Install uploadprogress
## -----
echononl "\tInstall uploadprogress via pecl.."
printf "\n" | ${PREFIX_PHP}/bin/pecl install uploadprogress > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "\tphp.ini: extension=uploadprogress .."
_extension="uploadprogress.so"
perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## -----
## - END: Install uploadprogress
## -----
## -----
## - Install solr
## -----
echononl "\tInstall solr via pecl.."
printf "\n" | ${PREFIX_PHP}/bin/pecl install solr > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "\tphp.ini: extension=solr .."
_extension="solr.so"
perl -i -n -p -e "s#^(\s*\[PHP\]\s*)#\1\nextension=${_extension}\n#" $PHP_INI_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## -----
## - END: Install solr
## -----
## -----
## - Configure php.ini (base)
## -----
## - set date.timezon = "Europe/Berlin"
## -
echononl "\tphp.ini: date.timezone = \"Europe/Berlin\""
_key="date.timezone"
_val="Europe/Berlin"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set short_open_tag = On
## -
echononl "\tphp.ini: short_open_tag = On"
_key="short_open_tag"
_val="Off"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set memory_limit = 256M
## -
echononl "\tphp.ini: memory_limit = 256M"
_key="memory_limit"
_val="256M"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set error_log = /var/log/apache2/php_error.log
## -
echononl "\tphp.ini: error_log = /var/log/apache2/php_error.log"
_key="error_log"
_val="/var/log/apache2/php_error.log"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set upload_max_filesize = 16M
## -
echononl "\tphp.ini: upload_max_filesize = 16M"
_key="upload_max_filesize"
_val="16M"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set post_max_size = 128M
## -
echononl "\tphp.ini: post_max_size = 128M"
_key="post_max_size"
_val="128M"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set max_file_uploads = 50
## -
echononl "\tphp.ini: max_file_uploads = 50"
_key="max_file_uploads"
_val=50
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set safe_mode = Off
## -
echononl "\tphp.ini: safe_mode = Off"
_key="safe_mode"
_val="Off"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## - set register_globals = Off
## -
echononl "\tphp.ini: register_globals = Off"
_key="register_globals"
_val="Off"
if grep -e "^\s*${_key}\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
elif grep -e "^\s*;\s*error_log\s*=" $PHP_INI_FILE > /dev/null 2>&1 ; then
perl -i -n -p -e "s#^(\s*;${_key}\s*=.*)#\1\n${_key} = ${_val}#" $PHP_INI_FILE
_retval=$?
fi
if [ "$_retval" = "0" ]; then
echo_ok
else
echo_failed
fi
## -----
## - END: Configure php.ini (base)
## -----
cd $pwd
if $WITHOUT_APACHE_MOD_PHP ; then
cat<<END
Webserver
=========
- Activate php for using with mod_fcgid. Put the following directives
- Create config directory for your site, create fcgi-wrapper inside and
copy the php-ini file \"$PHP_INI_FILE\" into the
created configuration directory.
_site_base_dir=/var/www/adm.warenform.de
mkdir \${_site_base_dir}/conf
mkdir /var/www/\${_site_base_dir}/tmp
chown www-data:www-data \${_site_base_dir}/conf /var/www/\${_site_base_dir}/tmp
cat<<EOF
#!/bin/sh
export PHPRC="/var/www/\${_site_base_dir}/conf/"
export TMPDIR="/var/www/\${_site_base_dir}/tmp"
exec \${PREFIX_PHP}/bin/php-cgi
EOF
cp \$PHP_INI_FILE /var/www/\${_site_base_dir}/conf/
VHost Configuration
===================
in your VHost config file:
DocumentRoot "<path-to-documentroot>"
<Directory <path-to-documentroot>>
FCGIWrapper <path-to-site-conf-dir>/fcgid .php
<FilesMatch \.php$>
SetHandler fcgid-script
</FilesMatch>
Options +ExecCGI -Indexes
</Directory>
END
else
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
fi
exit 0

View File

@ -0,0 +1,211 @@
#!/usr/bin/env bash
# php ( fuer Apache 2 )
#
VERSION=5.4.45
APACHE_VERSION=2.2.31
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://de.php.net/distributions/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" \
LDFLAGS="-s" \
./configure \
--prefix=$PREFIX_PHP \
--with-apxs2=$APXS \
--with-gd \
--with-config-file-path=${APACHE_BASEDIR}/conf \
--with-mysql \
--with-mysql-sock \
--with-mysqli \
--with-pdo-mysql \
--with-pgsql \
--with-regex=system \
--enable-wddx \
--enable-exif \
--with-zlib \
--with-openssl \
--with-gdbm \
--with-jpeg-dir \
--with-png-dir \
--with-curl \
--enable-dba \
--with-mcrypt \
--with-xpm-dir \
--with-t1lib \
--with-freetype-dir \
--enable-ftp \
--with-readline \
--with-mm \
--enable-sockets \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--enable-soap \
--enable-mbstring \
--enable-zip \
--enable-calendar \
--enable-bcmath \
--with-bz2 \
--enable-intl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
> ${_logdir}/php-configure.log 2>&1 || exit 1
## --with-pgsql=/usr/local/pgsql \
## --with-mysql=/usr/local/mysql \
## --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-production ${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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff