Archive
Tag "cpanel"

Any ded­i­cated server host­ing some web­sites that get mean­ing­ful traf­fic will quickly our­grow Cpanel's default /tmp folder size of 512MB. It houses PHP ses­sion files, tem­po­rary file uploads, your data­base tem­po­rary files, your web server's cache includ­ing the one from caches such as APC or eAc­cel­er­a­tor, and other such stuff.

With the tmp par­ti­tion full, the server will expe­ri­ence many ran­dom issues such as server crashes. Your sites will quickly go down and leave you head-scratching.

For­tu­nately, it's quite easy to resize the /tmp par­ti­tion on cPanel servers — espe­cially if it is the default one cre­ated by cPanel installs. There's a handy script at /scripts/securetmp.

Open this file:

pico /scripts/securetmp

And find this line:

my $tmpdsksize = 512000; # Must be larger than 250000

Change it to a larger num­ber than 512 MB. Say you want it to be 2 GB:

my $tmpdsksize = 2097152; # 2GB for the /tmp folder

Now close and save the file.

We need to stop all ser­vices that may be using this folder. For me, this includes MySQL, Apache and Nginx.

service mysql stop
service nginx stop
service httpd stop

Now we will sim­ply unmount the /tmp folder and recre­ate it. Here's the sequence of com­mands to cre­ate it:

lsof /tmp
umount -l /tmp
umount -l /var/tmp
rm -fv /usr/tmpDSK
/scripts/securetmp

Done. You can ver­ify the size of the /tmp folder among others:

df -h

This should show you some­thing like this:

...
/usr/tmpDSK ext3 2.0G 996M 1.1G 51% /tmp
...

NOTE: If you have any prob­lems, for instance, the size of the recre­ated /tmp folder is not really 2GB despite that code in the /scripts/securetmp we changed, it may be because of some set­tings you have in the /etc/fstab file. Take a look at it and com­ment out any lines that inter­fere with the LABEL for /tmp mount.

Read More

Sim­ple lit­tle trick to get to the lat­est version.

Most Cpanel/WHM servers come with PHP and Zend installed. With the recent (and impor­tant) update of PHP 5.2.1, the Zend Opti­mizer that is installed by default (ver­sion 3.0.1 as of this writ­ing) breaks.

You might begin to see a mes­sage like this:

[26-Apr-2007 10:32:49] PHP Warn­ing: Zend Opti­mizer does not sup­port this ver­sion of PHP — please upgrade to the lat­est ver­sion of Zend Opti­mizer in Unknown on line

To fix this, sim­ply login to your SSH as root and exe­cute the fol­low­ing com­mand to upgrade Zend Optimiser:

/scripts/installzendopt 3.2.8

Note that if you skip the ver­sion num­ber, Zend Opti­mizer 3.0.1 will be installed by default. The trick is to spec­ify the ver­sion as above. This will also work in the future, so as long as you know the lat­est released ver­sion of Zend Opti­mizer, just replace the red text above with that number.

Read More

The recent upgrades of Cpanel have been a pain because they've bro­ken mysql­hot­copy. Not kosher. For­tu­nately fix­ing this is pretty straight­for­ward by sim­ply down­grad­ing the DBD mod­ule of Perl, on which mysql­hot­copy relies.

Read More

Lat­est Cpanel updates are break­ing Mov­able type instal­la­tions, wreak­ing havoc with 500 Server Error mes­sages and caus­ing core dumps all over the place. Here's the kludg­ish workaround, that, well, works.

Lat­est Cpanel updates are break­ing Mov­able type instal­la­tions, wreak­ing havoc with 500 Server Error mes­sages and caus­ing core dumps all over the place. Here's the kludg­ish workaround, that, well, works.

A user on MT forums sug­gested that down­grad­ing to DBD::Mysql 2.9007 should do the trick. It does. Six Apart seems to be aware of it.

Here's a lit­tle script for Cpanel/WHM users to exe­cute on their SSH shells. Save it as, say, "dbidowngrade.sh" in your root folder, CHMOD it to 755, and exe­cute it with "./dbidowngrade.sh" at the com­mand prompt.

Impor­tant Note:

Yes, some peo­ple will have prob­lems with Cpanel updat­ing their DBD::Mysql with the /upcp script, in which case you should prob­a­bly set up a cron job to exe­cute the above script on a reg­u­lar basis. I have it up as hourly and it takes just a few sec­onds. I have com­mented out the lines in green because you don't need to down­load the file from CPAN more than once.

Please remem­ber, this is merely a tem­po­rary solu­tion. Mov­able Type should of course have an update soon, and Cpanel should shortly start pro­vid­ing the 3.0001 ver­sion in the near future.

Update: July 8, 2005

The lat­est update of DBD::Mysql, 3.0001_3, works for me. So here's the new code:

1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
cd /usr/src
 
wget -O dbd.tar.gz "http_//search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-3.0001_3.tar.gz"
gzip -cd dbd.tar.gz | tar xf -
rm -rf dbd.tar.gz
 
cd DBD-mysql-3.0001_3
perl Makefile.PL
make
make install

Update: July 6, 2005

Looks like the DBD::Mysql author has released a 3.0001_2 devel­oper update. I haven't been able to install it, it gives me a bunch of errors but that's par for the course from 'devel­oper' ver­sions of soft­ware. YMMV. I'll stick with the 2.9007 for now.

Orig­i­nal method: Down­grad­ing surely works

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
#---------------------------------------------
# Script to downgrade to DBD::mysql 2.9007
#---------------------------------------------
cd /usr/src
wget -O dbd.tar.gz "http_//www.cpan.org/modules/by-module/DBD/DBD-mysql-2.9007.tar.gz"
gzip -cd dbd.tar.gz | tar xf -
rm -rf dbd.tar.gz
cd DBD-mysql-2.9007
perl Makefile.PL
make
make install
 
# Clean up
cd /usr/src
rm -rf DBD-mysql-2.9007
Read More