Last active
May 3, 2016 10:01
-
-
Save Takika/dfabd00a5a9182f7a482 to your computer and use it in GitHub Desktop.
FreeBSD script to reorder php extensions to avoid sig11
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
#!/bin/sh | |
EGREP=/usr/bin/egrep | |
ECHO=/bin/echo | |
EXTENSIONS_INI=/usr/local/etc/php/extensions.ini | |
CP=/bin/cp | |
MV=/bin/mv | |
HAS_SPL=`$EGREP -c '^extension=spl.so$' $EXTENSIONS_INI` | |
HAS_SQLITE=`$EGREP -c '^extension=sqlite.so$' $EXTENSIONS_INI` | |
HAS_RECODE=`$EGREP -c '^extension=recode.so$' $EXTENSIONS_INI` | |
HAS_MYSQLI=`$EGREP -c '^extension=mysqli.so$' $EXTENSIONS_INI` | |
HAS_MYSQL=`$EGREP -c '^extension=mysql.so$' $EXTENSIONS_INI` | |
HAS_PDO=`$EGREP -c '^extension=pdo.so$' $EXTENSIONS_INI` | |
HAS_PDO_MYSQL=`$EGREP -c '^extension=pdo_mysql.so$' $EXTENSIONS_INI` | |
HAS_IMAP=`$EGREP -c '^extension=imap.so$' $EXTENSIONS_INI` | |
HAS_SOCKETS=`$EGREP -c '^extension=sockets.so$' $EXTENSIONS_INI` | |
HAS_PSPELL=`$EGREP -c '^extension=pspell.so$' $EXTENSIONS_INI` | |
HAS_XML=`$EGREP -c '^extension=xml.so$' $EXTENSIONS_INI` | |
HAS_SESSION=`$EGREP -c '^extension=session.so$' $EXTENSIONS_INI` | |
HAS_MEMCACHE=`$EGREP -c '^extension=memcache.so$' $EXTENSIONS_INI` | |
HAS_SOAP=`$EGREP -c '^extension=soap.so$' $EXTENSIONS_INI` | |
HAS_WDDX=`$EGREP -c '^extension=wddx.so$' $EXTENSIONS_INI` | |
HAS_APC=`$EGREP -c '^extension=apc.so$' $EXTENSIONS_INI` | |
HAS_APCU=`$EGREP -c '^extension=apcu.so$' $EXTENSIONS_INI` | |
HAS_REDIS=`$EGREP -c '^extension=redis.so$' $EXTENSIONS_INI` | |
$EGREP -v '(^extension=redis.so$|^extension=apcu.so$|^extension=apc.so$|^extension=wddx.so$|^extension=soap.so$|extension=session.so$|extension=memcache.so$|extension=spl.so$|^extension=sqlite.so$|^extension=recode.so$|^extension=mysqli.so$|^extension=mysql.so$|^extension=pdo.so$|^extension=pdo_mysql.so$|^extension=imap.so$|^extension=sockets.so$|^extension=pspell.so$|^extension=xml.so$)' $EXTENSIONS_INI > $EXTENSIONS_INI.tmp | |
if [ $HAS_SESSION = 1 ] | |
then | |
$ECHO "extension=session.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_MEMCACHE = 1 ] | |
then | |
$ECHO "extension=memcache.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_SOAP = 1 ] | |
then | |
$ECHO "extension=soap.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_SPL = 1 ] | |
then | |
$ECHO "extension=spl.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_SQLITE = 1 ] | |
then | |
$ECHO "extension=sqlite.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_RECODE = 1 ] | |
then | |
$ECHO "extension=recode.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_MYSQLI = 1 ] | |
then | |
$ECHO "extension=mysqli.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_MYSQL = 1 ] | |
then | |
$ECHO "extension=mysql.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_PDO = 1 ] | |
then | |
$ECHO "extension=pdo.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_PDO_MYSQL = 1 ] | |
then | |
$ECHO "extension=pdo_mysql.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_IMAP = 1 ] | |
then | |
$ECHO "extension=imap.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_SOCKETS = 1 ] | |
then | |
$ECHO "extension=sockets.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_PSPELL = 1 ] | |
then | |
$ECHO "extension=pspell.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_XML = 1 ] | |
then | |
$ECHO "extension=xml.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_WDDX = 1 ] | |
then | |
$ECHO "extension=wddx.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_APC = 1 ] | |
then | |
$ECHO "extension=apc.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_APCU = 1 ] | |
then | |
$ECHO "extension=apcu.so" >> $EXTENSIONS_INI.tmp | |
fi | |
if [ $HAS_REDIS = 1 ] | |
then | |
$ECHO "extension=redis.so" >> $EXTENSIONS_INI.tmp | |
fi | |
$CP $EXTENSIONS_INI $EXTENSIONS_INI.old | |
$MV $EXTENSIONS_INI.tmp $EXTENSIONS_INI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, I fixed it. I checked the session+redis order with a little script, the current order is good, no sig11 with redis sessions.