Downgrading PHP with the new EasyApache

Howdy,

cPanel is now upgrading php via an EA by default which when run, can upgrade a customers default php version to 5.4. As mentioned in an earlier post, part of cPanels EA EndOfLife email, 5.2.17 is no longer included in the php version list for EA. With that said, cPanel has made the downgrade process extremely simple. Below are the simple copy/pasta instructions for downgrading the php to 5.2.17 with the new EA version.

cd /var/cpanel/easy/apache/custom_opt_mods/
wget http://docs.cpanel.net/twiki/pub/EasyApache/EasyApacheCustomModules/custom_opt_mod-PHP5217.tar.gz
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-PHP5217.tar.gz
/scripts/easyapache

When the EA starts, you will not see 5.2.17 under the php version list, it is instead on the next page in the “short options list”. Simply check the box for the 5.2.17 custom opt and start the EA. A short message pops up letting you know that the php version list will be marked “none” but the current version at the top still displays 5.2.17 upon the next run EA. The wget link is subject to change, so be sure to check the Available Modules list found in the cPanel link below:

http://docs.cpanel.net/twiki/bin/view/EasyApache/EasyApacheCustomModules

UPDATE: It seems that there is currently a problem with the custom opt that disables the php 5 extension list in EA, effectively preventing the installation of new modules and extensions through EA. It also appears that compiling with this new custom opt automatically removes certain modules that are already installed, including Ioncube, Mysqli and possibly others. More info to follow…

UPDATE 2: just finished discussing this with CPanel and they confirmed that support for 5.2.17 has been dropped. This is similar to the drop of php4 that occurred with the rollout of php5.4. While EA will no longer offer extension installation with the 5.2.17 module, we can still install the modules using rawopts. The instructions provided by cPanel seemed comprehensive and we have confirmed they work using the example provided below. In this example, we compile curl through a manual EA using the rawopts with 5.2.17 in place.

bash-3.2# touch /var/cpanel/easy/apache/rawopts/all_php5
bash-3.2# echo "--with-curl" >> /var/cpanel/easy/apache/rawopts/all_php5
bash-3.2# /scripts/easyapache --build

I can confirmed that the second command works to append new extensions to the all_php5 on a new line as needed so you can substitute --with-curl for --with-gd and it will append --with-gd to the next line and you can run the EA with --build to compile both. With that in mind, running the EA to compile the custom-mod for 5.2.17 still removes certain modules, so be sure to copy the list of current modules from the EA or php -m and compare them once the EA completes in order to add any missing modules back to the server using the rawopts file.

UPDATE 3: We ran into several errors when adding the “–with-$module” to /var/cpanel/easy/apache/rawopts/all_php5. The shared libraries for the modules are not installed and easyapache will not install them. You have to install them manually.

http://nightkidx.com/wp/?p=46

*Please note the link above has the -y flag on every command. The -y flag is the yes flag, which means you are saying yes to every questions yum may ask. *We should never use the -y flag*. Then you can run “/scripts/easyapache –build”.

Also the extensions for php 5.2.x can be installed. Cpanel has a script that will install them. The script is “/scripts/phpextensionmgr”. You can list all the extensions with the –list flag. The following link provides an example to install ioncube loader.

http://docs.whmcs.com/Ioncube_Installation_Tutorial#For_cPanel

So, in a nutshell…

cd /var/cpanel/easy/apache/custom_opt_mods/
wget http://docs.cpanel.net/twiki/pub/EasyApache/EasyApacheCustomModules/custom_opt_mod-PHP5217.tar.gz
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-PHP5217.tar.gz

vim /var/cpanel/easy/apache/rawopts/all_php5

--enable-exif
--with-gettext
--with-imap=/opt/php_with_imap_client/
--enable-mbstring
--with-mysql-sock=/var/lib/mysql/mysql.sock
--with-mysqli=/usr/bin/mysql_config
--with-openssl=/usr
--enable-pdo=shared
--with-pdo-mysql=shared
--with-pdo-sqlite=shared
--with-sqlite=shared
--with-mime-magic
--enable-soap
--with-pspell
--enable-wddx
--with-xmlrpc
--with-xsl=/opt/xslt/
--with-kerberos
--with-curl
--enable-zip

yum install aspell aspell-devel tidy libtidy libtidy-devel libxslt libxslt-devel

wget -O /usr/local/src/tidy-1.2.tgz http://pecl.php.net/get/tidy-1.2.tgz
cd /usr/local/src/
tar zxvf tidy-1.2.tgz
cd tidy-1.2
phpize
./configure
make
make install
php --ini
# add tidy.so extension, use path from make install.

# run ea, select no PHP in first PHP screen and select PHP in second screen.

once complete, run:
/scripts/phpextensionmgr install IonCubeLoader
/scripts/phpextensionmgr install Zendopt

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....