Archive for » 2009 «

/scripts/fixquotas gives error “edquota: Quota file not found or has wrong format”?

After running /scripts/fixquotas it gives following error message and showing unlimited disk space in WHM >> Main >> List account.

root@server [/]# /scripts/fixquotas –force
Installing Default Quota Databases……Done
Linux Quota Support
Quotas are now on
Resetting quota for user23 to 1000 M
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
Resetting quota for user2 to 1000 M
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
Resetting quota for dates to 1000 M
Resetting quota for userq to 1000 M
edquota: Quota file not found or has wrong format.

In this case refer following steps.

root@server [/]#touch /home/quota.user
root@server [/]#touch /home/quota.group
root@server [/]#chmod 600 /home/quota.user
root@server [/]#chmod 600 /home/quota.group

root@server [/]#quotacheck -acugv

Some time above command gives error message

root@server [/]# quotacheck -acugv
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.

Than run following command

root@server [/]# quotacheck -acugvm
quotacheck: Scanning /dev/simfs [/] quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
done
quotacheck: Checked 33478 directories and 368211 files
quotacheck: Old file not found.
quotacheck: Old file not found.

Now run

root@server [/]#/scripts/fixquotas –force

It will sort out your issue ENJOY :)

How to install Webmin?

You can install webmin by using following steps.

root@gunjan[~]#cd /usr/local/src

root@gunjan[~]#wget http://sourceforge.net/projects/webadmin/files/webmin/1.500/webmin-1.500-1.noarch.rpm/download

root@gunjan[~]#rpm -Uvh webmin-1.500-1.noarch.rpm

warning: webmin-1.500-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID xxxxx
Preparing… ########################################### [100%]
Operating system is CentOS Linux
1:webmin ########################################### [100%]
Webmin install complete. You can now login to http://server.domain.com:10000/
as root with your root password.

How to install YUM on plain Server?

First you need to login into shell as root user than follow the steps one by one.

[root@gunjan]#mkdir /root/support  && cd /root/support

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/gmp-4.1.4-10.el5.i386.rpm

[root@gunjan]#rpm -Uvh gmp-4.1.4-10.el5.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/readline-5.1-3.el5.i386.rpm

[root@gunjan]#rpm -Uvh readline-5.1-3.el5.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-2.4.3-27.el5.i386.rpm

[root@gunjan]#rpm -Uvh python-2.4.3-27.el5.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/libxml2-2.6.26-2.1.2.8.i386.rpm

[root@gunjan]#rpm -Uvh libxml2-2.6.26-2.1.2.8.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/libxml2-python-2.6.26-2.1.2.8.i386.rpm

[root@gunjan]#rpm -Uvh libxml2-python-2.6.26-2.1.2.8.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/expat-1.95.8-8.2.1.i386.rpm

[root@gunjan]#rpm -Uvh expat-1.95.8-8.2.1.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm

[root@gunjan]#rpm -Uvh python-elementtree-1.2.6-5.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/sqlite-3.3.6-5.i386.rpm

[root@gunjan]#rpm -Uvh sqlite-3.3.6-5.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-sqlite-1.1.7-1.2.1.i386.rpm

[root@gunjan]#rpm -Uvh python-sqlite-1.1.7-1.2.1.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/elfutils-0.137-3.el5.i386.rpm

[root@gunjan]#rpm -Uvh elfutils-0.137-3.el5.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/rpm-python-4.4.2.3-18.el5.i386.rpm

[root@gunjan]#rpm -Uvh rpm-python-4.4.2.3-18.el5.i386.rpm

[root@gunjan]#It will throw following error.

[root@gunjan]# rpm -Uvh rpm-python-4.4.2.3-18.el5.i386.rpm

warning: rpm-python-4.4.2.3-18.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
popt = 1.10.2.3-18.el5 is needed by rpm-python-4.4.2.3-18.el5.i386
rpm = 4.4.2.3-18.el5 is needed by rpm-python-4.4.2.3-18.el5.i386
rpm-libs = 4.4.2.3-18.el5 is needed by rpm-python-4.4.2.3-18.el5.i386

In that case search dependencies in following URL

http://rpm.pbone.net/

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/m2crypto-0.16-6.el5.6.i386.rpm

[root@gunjan]#rpm -Uvh m2crypto-0.16-6.el5.6.i386.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-urlgrabber-3.1.0-5.el5.noarch.rpm

[root@gunjan]#rpm -Uvh python-urlgrabber-3.1.0-5.el5.noarch.rpm

[root@gunjan]#wget http://mirror.centos.org/centos-5/5/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm

[root@gunjan]#rpm -Uvh yum-3.2.22-20.el5.centos.noarch.rpm

It will throw following error.

[root@gunjan]# rpm -Uvh yum-3.2.22-20.el5.centos.noarch.rpm
warning: yum-3.2.22-20.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
python-iniparse is needed by yum-3.2.22-20.el5.centos.noarch
rpm-python is needed by yum-3.2.22-20.el5.centos.noarch
yum-fastestmirror is needed by yum-3.2.22-20.el5.centos.noarch
yum-metadata-parser >= 1.1.0 is needed by yum-3.2.22-20.el5.centos.noarch

In that case search dependencies in following URL

http://rpm.pbone.net/

Once you complete all dependencies you can update yum by using following command

[root@gunjan]#yum -y update

PHP Parse error: syntax error, unexpected T_STRING?

If you receive following error in the error logs

” PHP Parse error: syntax error, unexpected T_STRING”
Then you can add following line in the .htaccess file

php_flag short_open_tag X

Or

If your server is SuExec enabled then you can use following code in php.ini file
short_open_tag = X

Maximum file limit reach while starting Apache?

Maximum file limit reach error is occur while we are starting the Apache server at that time you can fix the issue by using root login details.

root@gunjan[~]#pico /etc/sysctl.conf
Add following line as

fs.file-max = 22992

Save and exit from the file.

You need to run following command from shell to active changes.

root@gunjan[~]#sysctl -p
It will increase the maximum number of open files for your Server.

How to stop forum get injected from hackers?

In now a days its very easy to inject any forum.You can secure your forum by using following code in your .htaccess

#spam bots SetEnvIfNoCase User-Agent “^EmailSiphon” bad_bot SetEnvIfNoCase User-Agent “^EmailWolf” bad_bot SetEnvIfNoCase User-Agent “^ExtractorPro” bad_bot SetEnvIfNoCase User-Agent “^CherryPicker” bad_bot SetEnvIfNoCase User-Agent “^NICErsPRO” bad_bot SetEnvIfNoCase User-Agent “^Teleport” bad_bot SetEnvIfNoCase User-Agent “^EmailCollector” bad_bot #plagarism bot SetEnvIfNoCase User-Agent “^TurnitinBot” bad_bot #IP bot SetEnvIfNoCase User-Agent “^NPBot” bad_bot #Worm sign SetEnvIfNoCase User-Agent “^LWP::Simple” bad_bot SetEnvIfNoCase User-Agent “^lwp-trivial” bad_bot SetEnvIfNoCase User-Agent “^lwp” bad_bot SetEnvIfNoCase User-Agent “^LWP” bad_bot #Worm sign Order Allow,Deny Allow from all Deny from env=bad_bot

Category: .htaccess, Third party script issue  Comments off

How to install install Eaccelerator?

To install Eaccelerator manually refer following steps one by one carefully.

1. First you need to login into shell as root user

2. Now we’ll make the eaccelerator directory:

root@gunjan[]#cd ~

root@gunjan[~]#mkdir /eaccelerator/

root@gunjan[~]#cd /eaccelerator/

2. Now download the source file

root@gunjan[~]#wget http://heanet.dl.sourceforge.net/sourceforge/eaccelerator/eaccelerator-0.9.4-rc1.tar.bz2

root@gunjan[~]#bzip2 -d eaccelerator-0.9.4-rc1.tar.bz2

root@gunjan[~]#tar xvf eaccelerator-0.9.4-rc1.tar

3. Now install Eaccelerator:

root@gunjan[~]#cd eaccelerator-0.9.4-rc1/

root@gunjan[~]#export PHP_PREFIX=”/usr”

root@gunjan[~]#$PHP_PREFIX/bin/phpize

root@gunjan[~]#./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config

root@gunjan[~]#make

root@gunjan[~]#make install

4. Now basically eaccelerator installed, now we need to edit the php.ini files to
include Eaccelerator extension.

root@gunjan[~]#php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

root@gunjan[~]#pico /usr/local/lib/php.ini

copy and paste following lines php.ini carefully
———————-
extension=”eaccelerator.so”
eaccelerator.shm_size=”16?
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1?
eaccelerator.optimizer=”1?
eaccelerator.check_mtime=”1?
eaccelerator.debug=”0?
eaccelerator.filter=””
eaccelerator.shm_max=”0?
eaccelerator.shm_ttl=”0?
eaccelerator.shm_prune_period=”0?
eaccelerator.shm_only=”0?
eaccelerator.compress=”1?
eaccelerator.compress_level=”9?
———————-

For a Zend extension install server (only if you have Zend installed on your server, or
if you’re going to install it)

———————-
zend_extension=”/usr/lib/php4/eaccelerator.so”
eaccelerator.shm_size=”16?
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1?
eaccelerator.optimizer=”1?
eaccelerator.check_mtime=”1?
eaccelerator.debug=”0?
eaccelerator.filter=””
eaccelerator.shm_max=”0?
eaccelerator.shm_ttl=”0?
eaccelerator.shm_prune_period=”0?
eaccelerator.shm_only=”0?
eaccelerator.compress=”1?
eaccelerator.compress_level=”9?
———————-

5. Now you need to make the cache directory on your server, where the cache files will be
stored for eaccelerator
root@gunjan[]#cd ~

root@gunjan[~]#mkdir /tmp/eaccelerator/

root@gunjan[~]#chmod 0777 /tmp/eaccelerator/

6. Now restart Apache so that Eaccelerator will start working:

service httpd restart

Now check eAccelerator by using following command

root@gunjan[~]#php -v
PHP 5.2.11 with Suhosin-Patch 0.9.7 (cli) (built: Nov 20 2009 14:28:34)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with the ionCube PHP Loader v3.3.7, Copyright (c) 2002-2009, by ionCube Ltd., and
with SourceGuardian v8.0, Copyright (c) 2000-2009, by Inovica Ltd.
with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

You done it enjoy :)

How to parse php pages in html page?

You can use following code in .htaccess file to parse php pages in html pages

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

To can check above code is working ir not? by creating one test page with following code

root@gunjan[~]#pico test.html

< html>
< head>
< body>
< h1>
< ?php echo "WORKING FINE!"; ?>
< /h1>
< /body>
< /html>