If you are facing any issues while parsing .html, .htm, .jsp, .js and other extension files through php, add the below code in the .htaccess file under the diretcory

AddHandler application/x-httpd-php5 .js .html .htm .jsp >> Server with php5

AddHandler application/x-httpd-php4 .js .html .htm .jsp >> Server with php4

If you want to limit the parsing just for a file add the code below

For php5

<FilesMatch “filename.js”>
AddHandler application/x-httpd-php5 .js
</FilesMatch>

For php4

<FilesMatch “filename.js”>
AddHandler application/x-httpd-php4 .js
</FilesMatch>

728x90-new

Roundcube stucks

Not able to send emails from roundcube. Roundcube stucks while sending the email (after clicking on Send Now)

Here are the steps to get this fixed :)

Open the file

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

Find for

$rcmail_config['smtp_pass'] = ”;
$rcmail_config['smtp_user'] = ”;

You will find the %u %p in the single quotes. Remove or add them accordingly.

Try sending email now.

While accessing the .jsp pages or restarting tomcat on the server you face the error “java.lang.OutOfMemoryError: PermGen space”.  The error occurs due to the memry outage for the tomcat service on the server. By default the tomcat uses 128 Mb of memroy. You can increase the memory with the steps below and get rid off the errors.

============================
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.OutOfMemoryError: PermGen space

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
Apache Tomcat/5.5.25
============================

1) vi /usr/local/jakarta/tomcat/bin/catalina.sh

2) Add following line into the catalina.sh file.

JAVA_OPTS=”-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC”
Which will look like

===========================================
# JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
# (JSSE) installation, whose JAR files will be added to the
# system class path used to start Tomcat.
#
# CATALINA_PID (Optional) Path of the file which should contains the pid
# of catalina startup java process, when start (fork) is used
#
# $Id: catalina.sh 609438 2008-01-06 22:14:28Z markt $
# —————————————————————————–

JAVA_OPTS=”-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC”

# OS specific support. $var _must_ be set to either true or false.
cygwin=false
os400=false
darwin=false
========================================

Save and exit

Restart Tomcat.

You are done !

Login to the server via SSH and fire the commands below

root@server [~]# /scripts/addservlets –domain.com

Now,  if you want to remove the servlets for the domain you can use the command below

root@server [~]# /scripts/remservlets –domain.com

Restart the tomcat on the server once.

You can try uploading the .jsp pages under the account and check.

Core Files

You may come across core files which gets generated within your accounts . The possible reason for the core files getting generated is when a php process is killed, apache creates core files under your account.

On phpSuexec servers this may cause due to incorrect php.ini file placed in your account and if it is caused due to php/apache then you can get rid off those core files by editing the httpd startup file on the server end.

Follow the steps below to stop the core file creation on the server.

root@server [~]# vi /etc/init.d/httpd

Search for ulimit lines .

For eg : you can see these lines

ulimit -n 1024
ulimit -n 4096
ulimit -n 8192
ulimit -n 16384

You need to add ulimit -c 0 at the end .

Which will look like :

ulimit -n 1024
ulimit -n 4096
ulimit -n 8192
ulimit -n 16384
ulimit -c 0

Save changes and quit.

Now kill / stop apache service and then start apache service on the server .

root@server [~]# service httpd stop

root@server [~]# service httpd startssl

Error :: Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly

Solution::

1. Login in to the Shell with the root user and then open the file using your favorite editor.

vi /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini

2. Search for [Session] and change the following

FROM:
—–
session.save_handler = sqlite
session.save_path =/var/cpanel/userhomes/cpanelphpmyadmin/sessions/phpsess.sdb
—–
TO
—–
session.save_handler = files
session.save_path = /tmp
—–

Save & Exit

3. Restart apache  on the same.

You are done !

If you have ever wanted to display a message to your users when the log in through ssh, you just need to edit a couple of files.  The first one is:

vi /etc/motd

This file has the text that will be displayed when an authorized user logs in through SSH.  The next change we need to make is to the SSH configuration file, which tell it to display the MOTD (message of the day).  The file can be found here, on a CentOS 5 system:

vi /etc/ssh/sshd_config

Look for the line containing PrintMotd and change the value to yes.  Make sure it is also uncommented.  If you wish to have a custom message for each user, it can be done a couple of different ways, however, I will only show you one.  We will create a new directory, and within that directory, give each user that has SSH access a file to use for a custom message.  Then, we need to edit the login script that the users use, in this case, bashrc, to include the per user file.

mkdir /etc/usermotd  <– makes the directory that we will use

vi /etc/usermotd/username <– this is where you would add the text you wish to display.

vi /etc/bashrc <– edit the bash file to include our new user motd

You need to add the below to the bottom of the bashrc file:

if [ -f /etc/usermotd/${USER} ]; then
cat /etc/usermotd/${USER};
fi

Save & quit

You are done !!!

awstats outside cPanel

Follow the steps below to access the awstats outside the cPanel

Step 1.

Download awstats

root@master [~]# cd /home/username/public_html
root@master [~]# wget http://prdownloads.sourceforge.net/awstats/awstats-6.9.tar.gz

Step 2.

Uncompress  awstats-5.6.tgz

root@master [~]# tar -zxvf awstats-6.9.tar.gz

Step 3.

Copy the contents of the uncompressed cgi-bin folder from your hard drive to the user  cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories).

root@master [~]# cp -af awstats-6.9/wwwroot/cgi-bin .

Step 4.

If necessary (should not be needed with most setups), edit the first (top-most) line of awstats.pl file that is
#!/usr/bin/perl
to reflect the path were your Perl interpreter is installed. Default value works for most of Unix OS, but it also might be
#!/usr/local/bin/perl

root@master [~]# which perl
root@master [~]# vi cgi-bin/awstats.pl

Step 5.

Move AWStats icon sub-directories and its content into a directory readable by your web server, for example /home/users/public_html/icons

root@master [~]# cp -af awstats-6.9/wwwroot/icon .

Step 6.

Copy awstats.model.conf file into a new file named awstats.myvirtualhostname.conf. This new file must be stored in
/home/user/public_html/cgi-bin.

root@master [~]# cp -af cgi-bin/awstats.model.conf cgi-bin/awstats.domain.conf

Step 7.

Edit this new config file with your own setup :
- Change LogFile value with full path of your web server log file
(The path is:
LogFile=”/usr/local/apache/domlogs/domain.com”).

- Check if LogFormat has the value “1″ (it means “NCSA apache combined/ELF/XLF log format”).

- Change DirIcons parameter to reflect relative path of icon directory.
(DirIcons=”/home/username/public_html/icons”)

- Edit SiteDomain parameter with the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mydomain.com).

IMPORTANT!
- Change DirData to use the same Statics file than Cpanel Awstats and do not loose any entry.
(DirData=”/home/user/tmp/awstats/”)

Step 8.

Access AwStats by the URL:

www.domain.com/cgi-bin/awstats.pl?config=domain.com

That’s all!!!

The AwStats will refresh the Statics every 24 Hours.

Below commands can be used to check file and diretcory permissions under the present working diretcory (pwd)

  • Check files with permission 755

root@master [~]# find $x -type f -perm 755

  • Check files with permission 777

root@master [~]# find $x -type f -perm 777

  • Check diretcory with permissions 777

root@master [~]# find $x -type d -perm 777

  • Check diretcory with permissions 000

root@master [~]# find $x -type d -perm 000

You can change the permissions to the value you  you want to search.

Typo3 database error

Database Error !
The current username, password or host was not accepted when the connection to the database was attempted to be established!

If you are receiving error mentioned above after installing typo3, please follow the steps below.

1. Open the file typo3_src/t3lib/config_default.php
2. Find for ‘no_pconnect’ the default value set will be 0. Change the value for ‘no_pconnect’ to 1. This will look like

‘no_pconnect’ => 1

3. Save the file and exit.

mysql_pconnect will be disabled on servers for security reasons. By default, typo3 uses mysql_pconnect to connect to the database. Changing the value for no_pconnect to 1 will use mysql_connect to connect to the database.