Latest blog entry

Unable to start init, probably incorrect template

January 31, 2010    |   Posted by admin   |    Category: VPS Management

You may receive an error “Unable to start init, probably incorrect template” while starting a VPS. The “incorrect template” problem occurs when the “init” on the VPS goes missing. The init file resides under /sbin i.e. check

ls -la /vz/private/VEID/sbin/init

of a VPS. If the file is missing or the file size is zero, your VPS won’t start. In order to resolve problem, you can either copy the ‘init’ from a different VPS using the same OS template i.e.

cp /vz/root/VEID1/sbin/init /vz/private/VEID/sbin/

OR

you can untar the OS template located under /vz/template/cache/ directory and copy the ‘init’ file there i.e.

tar -zxf /vz/template/cache/os_template.tar.gz
cp /vz/template/cache/sbin/init /vz/private/VEID/sbin/

Once done, you will be able to start your VPS.

vzctl start VEID

Comments Off on Unable to start init, probably incorrect template

How to install SuPHP/phpSuExec on Plesk?

January 24, 2010    |   Posted by admin   |    Category: Plesk Management

How to install SuPHP/phpSuExec on a Plesk server?

SuPHP Or PHPSuExec is a module that increases the security of the server and executes PHP files under the ownership of the owner of the file instead of the Apache user i.e. “apache”.

The advantages of having suPHP are:

1. Files and Directories those need 777 permissions to write into, via the browser will now need a maximum of 755 permissions. The files/directories with 777 permissions will result in an “Internal Server Error”.

2. If you need to manipulate the value of a php directive for a domain, for ex. register_globals, it needs to be placed in the php.ini of a domain instead of the .htaccess file as it will result in an “Internal Server Error”.

3. All the files and directories uploaded using a script will have the ownership of the user instead of user ‘apache’ (i.e. the Apache user).

4. A user can edit/remove the files using Ftp that are uploaded via the browser.

In order to install SuPHP on the server, download and install the atomic script

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

Once the script is installed, install SuPHP module using yum

# yum install mod_suphp

The next step is to load the SuPHP module with Apache. The suphp installation automatically creates a “suphp.conf” file under the Apache configuration directory, if not create it.

# vi /etc/httpd/conf.d/suphp.conf

and insert the following lines:

#Load the Mod_SuPHP module
LoadModule suphp_module modules/mod_suphp.so
php_admin_value engine off
# Enable handlers
suPHP_AddHandler x-httpd-php
AddHandler x-httpd-php .php .php3 .php4 .php5
#Enable the SuPHP engine
suPHP_Engine on

Apache calls all the configuration files from the /etc/httpd/conf.d directory by default so there is no need to include the module in the httpd.conf file separately.

Now,  configuration file under /etc should be present (if not create it)

vi /etc/suphp.conf

copy/paste the following contents as it is:

[global]
logfile=/var/log/suphp.log
loglevel=info
webserver_user=apache
docroot=/var/www/vhosts
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false
check_vhost_docroot=false
errors_to_browser=false
env_path=/bin:/usr/bin
umask=0022
min_uid=500
min_gid=500

[handlers]
x-httpd-php="php:/usr/bin/php-cgi"
x-suphp-cgi="execute:!self"

Make sure the “handle_userdir” directive is commented or removed from the file since it is deprecated from the latest version.

At the end, we have to restart the httpd service for all these changes to take effect

# service httpd restart

Test the SuPHP installation: Create a phpinfo.php file with 777 permission and it should show you an “Internal Server Error” on browsing.

Related Links:
How to install/enable SuPHP on a cPanel server?

Failed domain creation: Unable to update domain data

January 22, 2010    |   Posted by admin   |    Category: Plesk Management

You may come across the “Failed domain creation” error message while adding a domain from the Plesk control panel.

Failed domain creation: Unable to update domain data: Failed setting of domain parameters: Cannot change Webmail on domain: webmail
0: DomainPropertiesUIPointer.php:267
DomainPropertiesUIPointer->accessItem_create(string ‘POST’)
1: DomainPropertiesUIPointer.php:59
DomainPropertiesUIPointer->accessItem(string ‘POST’, NULL null)
2: UIPointer.php:596
UIPointer->access(string ‘POST’)
3: plesk.php:38

The fix provided across the internet is to install the psa-hotfix3 but it doesn’t work. In order to resolve the Plesk domain creation issue, run the autoinstaller in order to upgrade the installed components. The autoinstaller is use to install the new components offered by Plesk OR to upgrade the existing ones.

/usr/local/psa/admin/sbin/autoinstaller –select-release-current –upgrade-installed-components –debug

Comments Off on Failed domain creation: Unable to update domain data

How to enable ‘General Query Log’ in Mysql?

January 17, 2010    |   Posted by admin   |    Category: Mysql & PostGres SQL

General Query Log is used to keep track of mysql status i.e. it writes the information when a client connects/disconnects OR a query is executed. It is useful when the number of people managing the database is high. In order to enable ‘General Query Log’,

edit the Mysql configuration file

vi /etc/my.cnf

enable the log under the ‘mysqld’ section

log=/var/log/mysql.general.log

Save the file. Now create the log file and set the mysql ownership

touch /var/log/mysql.general.log
chown mysql.mysql /var/log/mysql.general.log

Now, restart the mysql service

/etc/init.d/mysql restart

You can now execute the queries using phpMyAdmin OR 3rd party sql software and watch the logs

tail -f /var/log/mysql.general.log

Comments Off on How to enable ‘General Query Log’ in Mysql?

Yum update. Error: rpmdb open failed

January 11, 2010    |   Posted by admin   |    Category: VPS Management

The “rpmdb open failed” error message is mostly received when the rpm databases __db.00* located under /var/lib/rpm directory are corrupted. This results in a “error: cannot open Packages database” message while installation/updatation of a package via yum.

root@server [~]# yum update
Loaded plugins: fastestmirror
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 309, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 157, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 187, in getOptionsConfig
self.conf
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 664, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 239, in _getConfig
self._conf = config.readMainConfig(startupconf)
File “/usr/lib/python2.4/site-packages/yum/config.py”, line 804, in readMainConfig
yumvars[‘releasever’] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File “/usr/lib/python2.4/site-packages/yum/config.py”, line 877, in _getsysver
idx = ts.dbMatch(‘provides’, distroverpkg)
TypeError: rpmdb open failed

The common fix is to delete the rpm databases and run rebuilddb, like

# yum clean all
# rm -f /var/lib/rpm/__db*
# rpm –rebuilddb
# yum update

However, in case of a VPS, yum may still not work with rebuilding rpm database and you have to try create a /dev/urandom device. Login to your VPS and execute

# rm /dev/urandom
# mknod -m 644 /dev/urandom c 1 9

The problem may reoccur on a VPS reboot so to fix the problem permanently, login to Hardware Node and execute:

# vzctl stop VEID
# mknod –mode 644 /vz/private/VEID/fs/root/dev/urandom c 1 9
# vzctl start VEID