Skip to content
October 7, 2009

How to install or upgrade to PHP 5.2.x

To upgrade to PHP 5.2.x on CentOS/RHEL/Fedora:

Step 1) Set up the atomic channel:

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh

Step 2) Upgrade to PHP 5.2.x:

yum upgrade

Step 3) Replace the PHP 4 php.ini with PHP 5.2.x’s (if applicable):

mv /etc/php.ini.rpmnew /etc/php.ini

Step 4) Replace the php.conf with the PHP 5.2.x php.conf (if applicable):

mv /etc/httpd/conf.d/php.conf.rpmnew /etc/httpd/conf.d/php.conf

Step 5) Restart the webserver

service httpd restart
(or)
/etc/init.d/httpd restart

Checklist

1) Source code installations of extensions, like Ioncube loader, or other extensions that have to be updated. Ive created php-ioncube-loader, php-zend-optimizer, and php-eaccelerator packages to fix this for you automatically.

2) php.ini settings, like memory_limit

3) execstack -c on any extensions that claim to need an executible stack (ASL users only).

Known Issues

1) VPS and RHEL users, If you dont use the atomic installer, you’re going to miss some dependencies, like sqlite3. Have fun with that!

2) RHEL4 users (and possibly others) can resolve the sqlite3 dependencies by grabbing rpms from the CentOS repositories. The atomic installer fixes this for you automatically. If you dont use it… have fun with that!

rpm -Uvh http://isoredirect.centos.org/centos/4/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm http://isoredirect.centos.org/centos/4/os/i386/CentOS/RPMS/sqlite-devel-3.3.6-2.i386.rpm
up2date php

OR

yum update php

Works like a charm

3) PHP 5.2.5 causes problems with Horde and Apache configuration files on PSA 8.2.1 and lower. PSA 8.3.0 has fixed this problem, so the easiest way to fix these issues is to upgrade to PSA 8.3.0 or higher. Otherwise, you’ll need to perform the following extra steps:

3a) Modify /etc/httpd/conf.d/zz010_psa_httpd.conf

Change this:

php_admin_value include_path "/usr/share/psa-horde:/usr/share/psa-horde/pear:."

to

php_admin_value include_path "/usr/share/psa-horde/lib:/usr/share/psa-horde:/usr/share/psa-horde/pear:."

Note this file is changed every time plesk is updated, so you’ll need to go back and fix this when it does.

This also fixes the PHP Fatal error: Can’t load Horde/SessionObjects.php, open_basedir restriction problem.

3b) General issues with php_admin_value:

The fix for now is to replace the use of php_admin_value with php_value. I have only tested this as far as the domains on this server. You will find this used all over the place in zz010_psa_httpd.conf, domain level httpd.includes, and most likely in your own customizations. The biggest problems Ive had are with register_globals and include_path, I have not run into any issues with PSA httpd.include files and open_basedir.

4) Plesk Sitebuilder is not compatible with 5.2.x on systems that did not come with it natively. Either remove it, with yum remove sb-publish, or you *might* be able to get it to work by using the php-sqlite2 from the Fedora 8 plesk repo. php-sqlite2 was added to the atomic repo to handle sitebuilder integration.

Problems with MySQL databases and PLESK 9 after upgrade.

If you get the following error after upgrading when you try to log into PLESK then you need to upgrade your database tables:

ERROR: PleskFatalException
bad column in table: `backup_time` time NOT NULL default '00:00:00',
[...]

Issue the following command from the shell:

mysqlcheck --check-upgrade --all-databases --auto-repair -uadmin -pyouradminpassword

followed by:

cat /usr/share/mysql/mysql_fix_privilege_tables.sql | /usr/bin/mysql –no-defaults –force –user=admin –password=youradminpassword —-host=localhost –database=mysql –host=localhost –database=mysql

September 6, 2009

Logging server load to /var/log/messages

There can be issues when the server goes offline and you can’t find any related log entries in the server. One of the issue that can cause is high load in the server. But we wont be able to conclude whether the load was the exact issue after the server reboot.

The better solution to find the load is set a cronjob to enter the load in the server to /var/log/messages for a particular amount of time. A sample cron is shown below which will log the server load every 10 minutes to /var/log/messages.

*/10 * * * * uptime | logger -t “SERVER LOAD”
Now you will be able to get the load from /var/log/messages

Now you will be able to get the load from /var/log/messages

September 6, 2009

MySQLTuner

Installation and Requirements:

The script is a basic Perl script that has no additional requirements. At this time, MySQLTuner is compatible with Linux/Unix based operating systems with Perl 5.6 or later. MySQL versions 3.23 and later are supported by the script.

To get started, simply download MySQLTuner and make it executable:

# wget http://mysqltuner.com/mysqltuner.pl
# chmod +x mysqltuner.pl
# ./mysqltuner.pl
August 29, 2009

How to update the exim.conf

To make use of the newest exim settings and enhancements, you can update the exim.conf by running the following as root::

wget -O /etc/exim.conf http://files.directadmin.com/services/exim.conf
wget -O /etc/exim.pl http://files.directadmin.com/services/exim.pl
chmod 755 /etc/exim.pl
cd /etc/virtual
touch blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders
echo 0 > limit
mkdir usage
chown mail:mail blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders limit usage

If you are running dovecot, you will need to re-patch your exim.conf:

patch -p0 < /usr/local/directadmin/customapache/exim.conf.dovecot.patch
patch -p0 < /usr/local/directadmin/custombuild/exim.conf.dovecot.patch

one thing you need to note that you only need to run the patch appropriate to the build system you have. If you have custombuild, run the 2nd one. If you don’t know what you have, then run them both, as it won’t hurt anything if you patch twice.

Restart the Exim now :

/etc/init.d/exim restart

August 26, 2009

How to install memcache on linux server?

memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load.

memcached is meant to work in concert with something like the MySQL query cache, not replace it. The two implementations excel at vastly different things: memcached is an object cache, while MySQL provides a query cache.

memcached is extremely fast. It uses libevent, which provides a mechanism to execute a callback function when a specific event occurs on a file descriptor, to scale to any number of open connections. On a modern Linux system memcached utilizes epoll, is completely non-blocking for network I/O, ensures memory never gets fragmented, and uses its own slab allocator and hash table to achieve 0(1) virtual memory allocation.

How it install it on Linux server ?

Install dependency software (Libevent)

#curl -O http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
#tar -xzvf libevent-1.4.9-stable.tar.gz
#cd libevent*
#./configure
#make
#make install 
  • Now let’s download the newest Memcached source
#curl -O http://www.danga.com/memcached/dist/memcached-1.3.0.tar.gz
#tar zxf memcached-1.3.0.tar.gz
#cd memcached-1.3.0
#./configure
#make
#make install
  • Then add /usr/local/lib to LD_LIBRARY_PATH in your .bash_profile
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH

How it Works

First, you start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you’ll likely use:

Run Memcached as a daemon (d = daemon, m = memory, u = user, l = IP to listen to, p = port)

#memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211 –u nobody

This starts memcached as a daemon (-d) on the IP address and port specified with -l and -p, respectively, running as the user nobody (-u), allocating 1024  for object storage (-m). You should adjust the amount of storage to suit your needs; many memcached installs run with 4 GB. Once you are comfortable with your startup options, add the appropriate command to your startup scripts.

Create a /etc/init.d/memcached file and add above line to start memcached when the server boots

With memcached installed and running, it’s time to get PHP talking to the object cache. While multiple PHP API exists, the one in the PECL repository is recommended. If you are running a newer version of PHP, installation is as simple as:

# pecl install memcache

Or you can use following steps to install PECL memcache manually.

#cd /usr/local/src
#curl -O http://pecl.php.net/get/memcache
#tar zxvf memcache*
#cd memcache-*
#phpize
#./configure
#make && make install

Now we have to make sure PHP loads the newly built memcache.so library by adding the following line to php.ini:

extension=memcache.so

Now restart Apache:

Service httpd restart

Once it sucussfully install you can create phpinfo() on your webserver should now confirm that memcache is installed.

August 26, 2009

I can not send outgoing email (Error Number: 0x800CCC0B)


If you can not send email using mail.yourdomainname.com as your SMTP server, it may be because your ISP is blocking port 25 on their network, used for sending outoing mail via the SMTP protocol. In this instance, we recommend using your ISPs outgoing mail server, which can be obtained from your ISP. This practice has been put in place in an effort to stop spam.

Please check with your ISP for their outgoing mail server settings (SMTP) and adjust in your email program under email account setup. Relaying mail through your ISP will not change the look and appearance of email you send. It will simply use your ISPs outgoing mail server to relay your message, which will appear from your email address, etc.

August 23, 2009

What is APF (Advanced Policy Firewall)? APF Firewall

APF is a policy based iptables firewall system designed for ease of use and configuration. It employs a subset of features to satisfy the veteran Linux user and the novice alike. Packaged in tar.gz format and RPM formats, make APF ideal for deployment in many server environments based on Linux. APF is developed and maintained by R-fx Networks: R-fx Networks – Internet Security Solutions – Projects » APF

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar
August 23, 2009

Server Load monitoring

Load monitoring and controlling
#top
#ps -aufx | grep nobody
#ps -aufx | grep pkgacct
#ps -aufx | grep mysql

====================
YOU CAN KILL NOBODY PROCESSESS

#kill -9 pid
#kill -9 $(pgrep -u nobody)
#kill -9 `ps -u nobody -o “pid=”`
#/etc/init.d/restart httpd

======================
EXIM
to delete frozen mails
#exim -bpr | grep frozen | awk {‘print $3′} | xargs exim -Mrm
=====================
MYSQL:

To kill mysql process found in mysqladmin processlist
#mysqladmin kill process id
====================
How to Monitor the services that is using up most of the cpu and memory on a server.

#ps auxfw|sort -nr|grep -v 0.0

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar


 
August 23, 2009

Basic Commands for Hardware Node(vz-commands)

These are the commands that can used while working on a Hardware Node.

* To check all the VPS’s hosted on a Node you need the following command: vzlist -a
* To start a VPS: vzctl start VPS_ID
* To Shutdown or Stop a VPS: vzctl stop VPS_ID
* To check the Status of a VPS: vzctl status VPS_ID
* To stop the VPS Forcefully or Quickly: vzctl stop VPS_ID fast
* To enter a Particular VPS: vzctl enter VPS_ID

August 23, 2009

#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured)

Issue : -

While accessing PhpMyAdmin getting the following error.

ERROR
#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured).


Reason :-

The mysql socket file is missing from the /tmp directory

Fix :-

1. Create a symbolic link from the original mysql socket file to /tmp

[root@test ~]# ln -s /var/lib/mysql/mysql.sock /tmp

OR

2. Restart MySQL service from WHM

WHM Login >> Main >> Restart Services >>SQL Server (MySQL)

OR

3. Edit the PhpMyAdmin configuration file to use the original MySQL socket file.

#  vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

Make sure, the correct mysql socket file is mentioned there.
———————-
$cfg['Servers'][$i]['socket'] = ‘/var/lib/mysql/mysql.sock’;
$cfg['Servers'][$i]['connect_type'] = ’socket’;

——————–

Follow

Get every new post delivered to your Inbox.