How to check if a server is Suexec or not?

To check the server is Suexec or not? follow the one of the steps which suitable with your privileges

1) Login into you server with the root login details and run following command

[root@xx.xx.xx ~]#/usr/local/cpanel/bin/rebuild_phpconf –current

If server is Suexec then result would look like

DEFAULT PHP: 5 PHP4
SAPI: suphp PHP5 SAPI:
suphp SUEXEC: enabled


Thank You.

Compling PHP4 with PHP5 on Plesk

Download PHP 4 source http://www.php.net/downloads.php :

[root@server]# cd /usr/local/src
[root@server]# wget http://museum.php.net/php4/php-4.4.7.tar.gz

UNTAR
[root@server]# tar -zxf php-4.4.5.tar.gz

CONFIGURE & COMPILE PHP4

[root@server]# cd php-4.4.7

[root@server]# ./configure '--prefix=/usr/local/php4' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--with-libdir=lib' '--with-config-file-path=/usr/local/php4/lib' '--with-pic' '--disable-rpath' '--with-exec-dir=/usr/bin' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-iconv' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--enable-calendar' '--with-libxml-dir=/usr' '--with-xml' '--enable-force-cgi-redirect' '--enable-pcntl' '--enable-mbstring' '--enable-mbregex' '--with-ncurses' '--with-gd' '--enable-bcmath' '--with-xmlrpc' '--with-mysql' '--with-mysqli' '--enable-dom' '--with-xsl' '--enable-fastcgi' '--program-suffix=4' '--with-expat-dir=/usr'

Note :: You may get too many errors while configuring PHP which can be easily resolved by installing required devel through YUM
(For exa:: yum install libmhash-devel), also you can always choose to remove an option above from the compile command if you can't or don't want to install a dependency..


Once the complie command succeeds, run:

make

then

make install

then Copy php source files.

[root@server]# cp -rf ./sapi/cgi/php /usr/local/php4/bin/
[root@server]# mkdir -pv /etc/httpd/cgi-sys/
[root@server]# cp -rf ./sapi/cgi/php /etc/httpd/cgi-sys/
[root@server]# cp -rf php.ini-recommended /usr/local/php4/lib/php.ini

Make a php4.conf file:

The previous PHP5 installation created a the file /etc/httpd/conf.d/php.conf- duplicate this file and rename it php4.conf, then edit the "DirectoryIndex" "Action" and "AddHandler" lines with the following information:

DirectoryIndex index.php4 index.php3
Action php4-script /cgi-bin/php
AddHandler php4-script .php3 .php4


and comment out the "LoadModule php5..." line

Instead of creating "php4.conf" you can add following lines at the bottom of the file /etc/httpd/conf/httpd.conf

ScriptAlias /cgi-sys/ /etc/httpd/cgi-sys/
Action application/x-httpd-php4 "/cgi-sys/php"
AddHandler application/x-httpd-php4 .php4


and then restart Apache:
[root@server]# /etc/init.d/httpd restart

Create link to PHP4 in Client's cgi-bin Directory
# Due to Security Issues the PHP4 CGI is installed at /usr/local/etc/php4/cgi/php.ini. In the Interworx virtual host setup using suexec, each user has their own cgi-bin. Do the following to link the PHP4 CGI into your hosting client's cgi-bin directory.

[root@server]# cd /chroot/home/client/public_html/cgi-bin
[root@server]# ln /usr/local/php4/bin/php php
[root@server]# chown client php
[root@server]# chgrp client php
[root@server]# chmod 755 php

Test your PHP installation
try creating a php.info doc for both versions of PHP:

/chroot/home/client/public_html/info.php4
/chroot/home/client/public_html/info.php
using the same code:

phpinfo();
?>

The phpinfo() function reports the version number, as well as the features that are compiled into PHP. You'll see that info.php4 uses php4 and info.php5 uses php5.



Most of these steps were gleaned from:

http://www.webhostingtalk.nl/directa...hp5-suphp.html
and
http://www.gsp.com/support/virtual/php/cgi.html
and
http://www.interworx.com/forums/showthread.php?t=1897

Thank You.

Cannot send emails- RoundCube just shows "Sending Message"

I found a problem with Roundcube, it shows sending message and hangs up there and actually it doesn't send message anymore. I found the following solution here.


Problem with Roundcube, installed when updated to newest CURRENT release. - Page 3 - cPanel Forums:


vi /usr/local/cpanel/base/3rdparty/roundcube/config/main.inc.php

and changed

$rcmail_config['smtp_user'] = '%u';
to
$rcmail_config['smtp_user'] = '';

FIXED....

Thanks :-)

Changing multiple account ownerships via SSH

Issue:

How to change the ownership of multiple accounts under /home via SSH? The option in WHM is a bit tedious.

Solution :

To change the ownership of all accounts to the respective user.user :

cd /home
ls -al | grep root

for i in `ls /var/cpanel/users/`; do chown $i:$i /home/$i ; done
for i in `ls /var/cpanel/users/`; do chown -R $i:$i /home/$i/* ; done

Then change the ownership of the individual public_htmls to their respective user.nobody:

for i in `ls /var/cpanel/users/`; do chown $i:nobody /home/$i/public_html ; done

Change the permissions for public_htmls to 750:

for i in `ls /var/cpanel/users/`; do chmod 750 /home/$i/public_html ; done

Fix the permissions for mail to work fine:

/scripts/mailperm

Fix the ownership of /home:

chown root.root /home

semget: No space left on device

Whenever you start Apache, it keeps crashing with error "semget: No space left on device".

# tail /etc/httpd/logs/error_log
semget: No space left on device
semget: No space left on device
[Wed Sep 12 10:54:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
[Wed Sep 12 10:56:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
[Wed Sep 12 10:58:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
[Wed Sep 12 11:00:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device

If you have similar problem as mine above + if your disk space is nowhere near/above 100% + /var/messages and /usr/local/apache/logs/error_log shows no clue about this problem + any files in /etc/httpd/logs/ and /etc/httpd/domlogs nowhere near/above 2GB in size, its most probably semaphore problem. Use the following script to cure your Apache.

#!/bin/bash

ipcs -s | grep nobody | perl -e 'while () {
@a=split(/\s+/); print `ipcrm sem $a[1]`}'

/scripts/restartsrv httpd

Script how to:
- SSH as root to your CPanel server
- Go to root dir

# cd /root


- Create a httpdsemclean.sh blank file

# pico httpdsemclean.sh


- Write above script
- Save

Ctrl + O


- Exit pico

Ctrl + X


- Chmod httpdsemclean.sh to 777

# chmod 777 httpdsemclean.sh


- Execute the script

./httpdsemclean.sh

If all goes fine, you'll see something like this:

...
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
Waiting for httpd to restart..............finished.

httpd started ok

PS: Do this at your own risk, we do not guarantee this will work on all CPanel servers!

sshd has failed, please contact the sysadmin

If you have changed the shell default Port 22 on a cPanel powered server , restarting sshd from the WHM will fail. You have to ssh to the server and issue the following command to restart sshd…

* /sbin/service sshd restart

To, temporarily, reset your shell port back to 22, run the following command from the Address field in browser:

SERVER_MAIN_IP:2087/scripts2/doautofixer?autofix=safesshrestart

Now, you should be able to access shell, and you need to restart sshd at the prompt using the command mentioned above

How To Install RED5 Server on Centos 5.3

In this how to i will describe how to install RED5 server on Centos 5.3. This how to can be used to install RED5 server on Centos 4 and Fedora 8 – 11 as well. RED5 is open source flash server written in java supports streaming audio/video, recording client streams, shared objects, live stream publishing etc.
1) Download and Install Java

RED5 server depends on Java. CentOS 5.3 comes with OpenJDK 1.6 and install it using yum.

yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

2) Download and Install Ant (Apache Project)

Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.

cd /usr/src
wget http://opensource.become.com/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz
tar zxvf apache-ant-1.7.1-bin.tar.gz
mv apache-ant-1.7.1/ /usr/local/ant

3) Export Variables for Ant and Java

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

Also export these variables in /etc/bashrc to become available for every user login or for any terminal opens.

echo ‘export ANT_HOME=/usr/local/ant’ >> /etc/bashrc
echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
echo ‘export PATH=$PATH:/usr/local/ant/bin’ >> /etc/bashrc
echo ‘export CLASSPATH=.:$JAVA_HOME/lib/classes.zip’ >> /etc/bashrc

4) Download and Install RED5 Server

Here the latest version available for RED5 is 0.7 on site but download from google code using svn as the tarball of 0.7 on site is missing some of the files.

cd /usr/src
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist

you will see a ton of lines, but you should get at last

BUILD SUCCESSFUL

that’s mean its install and now copy the conf directory from dist/ and test the red5 installation.

cp -r dist/conf .
./red5.sh

If it shows Installer service created in the last then everything is fine here, press ctrl+c and move to next step to create init script.
5) Init Script

Now we will create init script for red5 to start, stop and restart easily.

vi /etc/init.d/red5

download http://www.sohailriaz.com/downloads/red5.txt and copy / paste code in it. The init script code also be viewed below.

#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5

PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid

# Source function library
. /etc/rc.d/init.d/functions

[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5

RETVAL=0

case “$1″ in
start)
echo -n $”Starting $PROG: ”
cd $RED5_HOME
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG

fi
[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
echo
;;
stop)
echo -n $”Shutting down $PROG: ”
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|status}”
RETVAL=1
esac

exit $RETVAL

Now start the service

/etc/init.d/red5 start

check status

/etc/init.d/red5 status
red5 (pid XXXXX) is running…

again you can do stop, restart.