V-TEK Weblog about webdevelopment and linux

9Nov/071

Enable mime magic for php4 or php5 on a cpanel server

The following steps help you to enable mime magic on a cPanel server
1 - First do a ‘normal’ Apache Update with all the features you like
2 - Login into the commandline using putty or any other program that can be used to access commandline
3 - Edit the “buildscript” which you can locate at : /home/cpapachebuild/buildapache
4 - In that file search for the phrase “Running configure”.
5 - You will find 4 lines which start with “LDFLAGS=”, after them you append the following phrase “–with-xsl”
6 - For example it might look like this

if [ “1″ = “1″ ]; then
LDFLAGS=”-L/usr/X11R6/lib64 -lstdc++” $configure $PIC $APXS –prefix=/usr/local –with-xml $MM –enable-bcmath –enable-calendar –with-curl –enable-exif –with-swf=/usr/local/flash –enable-ftp $WITHGD –with-gettext –with-iconv $WITHIMAP –enable-mbstring –enable-mbstr-enc-trans –enable-mbregex –with-mcrypt –enable-magic-quotes $WITHMYSQL –with-openssl –enable-discard-path –with-pear –enable-xslt –with-xslt-sablot –enable-safe-mode –enable-sockets –enable-track-vars $ttfopts –enable-versioning –with-xmlrpc –with-zip –with-zlib –with-mime-magic
else
LDFLAGS=”-L/usr/X11R6/lib64″ $configure $PIC $APXS –prefix=/usr/local –with-xml $MM –enable-bcmath –enable-calendar –with-curl –enable-exif –with-swf=/usr/local/flash –enable-ftp $WITHGD –with-gettext –with-iconv $WITHIMAP –enable-mbstring –enable-mbstr-enc-trans –enable-mbregex –with-mcrypt –enable-magic-quotes $WITHMYSQL –with-openssl –enable-discard-path –with-pear –enable-xslt –with-xslt-sablot –enable-safe-mode –enable-sockets –enable-track-vars $ttfopts –enable-versioning –with-xmlrpc –with-zip –with-zlib –with-mime-magic
fi
echo “#undef COMPILE_DL_ZLIB” >> main/php_config.h

7 - Now save your “buildscript” file and run it from the commandline

8 - Now update the following line in your php.ini to let the magic point to the right file

mime_magic.magicfile = "$PHP_INSTALL_DIR\magic.mime"

( You can lookup the magic.mime file on your server using tools like find or locate )

About admin

No description. Please complete your profile.
Comments (1) Trackbacks (0)
  1. How can I tell if it is enabled if I dont have php.ini access


Leave a comment


No trackbacks yet.

Recent Comments

Tags

Apache cakephp cpanel dav dd-wrt DNS Ext3 Framework GIT GNU grub javascript Kernel lilo Linux LPI LVM MVC MySQL Netbeans Netfilter PHP piping ps3 redirection regex Ruby on Rails Samba Sendmail Shell Skype SNMP Squid Symfony ubuntu upnp vim windows X Xorg X Window System