dance :)

8 02 2010





Sitebuilder premature script error : Plesk

1 01 2010

Symptoms

The following error is shown on Sitebuilder logs file:

/var/log/httpd/sitebuilder_error.log
—>8—
[Tue Oct 27 11:48:00 2009] [warn] [client xxx.xxx.xxx.xxx] Timeout waiting for output from CGI script /opt/php52/cgi-bin/php5, referer: http://sitebuilder.hostname.com/Admin/Site/Form
[Tue Oct 27 11:48:00 2009] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: php5, referer: http://sitebuilder.hostname.com/Admin/Site/Form
—8<—

What can I do to solve the problem?

Cause

The problem is caused by long time of uploading files via FTP. Publishing is stopped due to timeout.

Resolution

To resolve the problem it is recommended that you 1) increase maximum time of script execution, parameter max_execution_time in Sitebuilder PHP configuration and 2) Timeout value in Apache configuration.

1) Login to Parallels Plesk Sitebuilder server as root and find location of CGI PHP configuration file in Parallels Plesk Sitebuilder:

~# sb_config –help | grep phpcgi_path
–phpcgi_path        PHP CGI executable [/opt/php52/cgi-bin/php5]
~# find /opt/php52 -name php.ini
/opt/php52/etc/php.ini
~#

Open file /opt/php52/etc/php.ini and find max_execution_time. Increase the value, it is 30 seconds by default and save the file.

—>8—
max_execution_time = 240     ; Maximum execution time of each script, in seconds
—>8—

2) On Parallels Plesk Sitebuilder server open main configuration file of Apache service (/etc/httpd/conf/httpd.conf).Find option Timeout and increase the value. For example:

—>8—
# Timeout: The number of seconds before receives and sends time out.
Timeout 240
—8<—

Save the file and restart service Apache. For example:

~# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
~#





Happy New Year

31 12 2009





Install pdflib and pdf.so in Plesk

21 10 2009

Download the pacakge, their official site is www.pdflib.com

root@server# wget http://www.pdflib.com/binaries/PDFlib/703/PDFlib-Lite-7.0.3.tar.gz
root@server#  tar xvzf PDFlib-Lite-7.0.3.tar.gz
root@server#  cd PDFlib-Lite-7.0.3
root@server#  ./configure --prefix=$HOME/usr --without-java
root@server#  make
root@server#  make install

install php-pear using

yum install php-pear


root@server#  pecl download pdflib
root@server#  tar xvzf pdflib-*.tgz
root@server#  cd pdflib-*
root@server#  phpize
root@server#  ./configure --with-pdflib=$HOME/usr
root@server#  make
root@server#  make test
make install

Add pdf.so in /etc/php.ini and restart httpd. You got it !!!




How to transfer sitebuilder data and user accounts to another Plesk server

20 10 2009

Source server :

take a back up of sites in /usr/local/sitebuilder/htdocs (in debian /opt/sitebuilder)

and move it to new server

scp -r /usr/local/sitebuilder/htdocs/sites/* root@targetserverip:/usr/local/sitebuilder/htdocs/sites/

correct the permissions as web server

chown apache.apache -R /usr/local/sitebuilder/htdocs/sites/  <new server >

After that we need to take sitebuilder backup

mysqldump -u admin -p`cat /etc/psa/.psa.shadow ` sitebuilder3 > sitebuilderback.sql

move it to new server using scp

After that restore the transferred sitebuilder dump in new server

mysql -u admin -p`cat /etc/psa/.psa.shadow ` sitebuilder3 < sitebuilderback.sql

After that login to the new server MySQL and select database sitebuilder3 and check the users using the command

select user_name from user where user_name not like ‘admin%’;

If you are seeing the users , you are DONE!!!





How to take domain database backup in plesk

11 10 2009

# cat domain_dump.sh
var_remote=’remote_ip_address’
mkdir /root/dump_temp/
mysql -u admin -p`cat /etc/psa/.psa.shadow ` -e “show databases” |grep -v “-” |grep -Ev ‘Database|information_schema’ >> /root/backuplist
for i in `cat /root/backuplist`;
do
echo “database is $i”
mysqldump -u admin -p`cat /etc/psa/.psa.shadow` $i > /root/dump_temp/$i.sql
echo “dump of $i created”
done
echo “Creating the tar file in /root”
cd /root
tar -cvzf /root/dump_`date +”%Y-%m-%d”`.tar.gz dump_temp/
lftp $var_remote<<EOF | sort>$TMPFILE
user “username” “password”
cd IP/directory
put dump_`date +”%Y-%m-%d”`.tar.gz
EOF
echo “Deleteing the backup files”
rm -rf /root/dump_temp
rm -rf /root/dump_`date +”%Y-%m-%d”`.tar.gz





Sqlite issue in Plesk ( Sitebuilder)

11 10 2009

Sqlite installed and updated.

  1. Download source package. You can get it from here: http://pecl.php.net/package/SQLite

# wget http://pecl.php.net/get/SQLite-1.0.3.tgz
or
# pear download sqlite

If publication host has x86_64 architecture it is suggested to use source files from here http://cvs.php.net/viewvc.cgi/pecl/sqlite/?pathrev=PHP_5_2 and make sure that SQLite library has version 2.8.17 or upper.

  1. Unpack SQLite-1.0.3.tgz to SQLite-1.0.3 directory:

# tar -xzf SQLite-1.0.3.tgz

  1. Move into SQLite-1.0.3 directory

# cd SQLite-1.0.3

  1. You need to have UTF-8 encoding support for sqlite.so extension, so following modification should be done:

edit SQLite-1.0.3/libsqlite/src/main.c file and change this section

#ifdef SQLITE_UTF8
const char sqlite_encoding[] = “UTF-8″;
#else
const char sqlite_encoding[] = “iso8859″;
#endif

to

//#ifdef SQLITE_UTF8
const char sqlite_encoding[] = “UTF-8″;
//#else
//const char sqlite_encoding[] = “iso8859″;
//#endif

comment all strings excluding one with UTF-8 encoding.

  1. Find phpize binary file and run it. Location for this file can be different. Standard path is /usr/bin/phpize. Make sure that you are still in SQLite-1.0.3 directory and run the following command:

# /usr/bin/phpize (path to phpize can be different)

If there is no such file, try to find it with following commands:

# whereis phpize
# locate phpize|grep bin

  1. Find location for php-config file. It should be the same as for phpize file and run following commands:

    # ./configure –with-sqlite –with-php-config=/usr/bin/php-config (path to php-config can be different)

  2. Run ‘make’ command:

# make

If you meet something like that:

“error: `BYREF_NONE’ undeclared”

you will need edit sqlite.c comment out the following line:

/* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */

And then change these lines

function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, arg3_force_ref)
PHP_FE(sqlite_popen, arg3_force_ref)


to

function_entry sqlite_functions[] = {
PHP_FE(sqlite_open, third_arg_force_ref)
PHP_FE(sqlite_popen, third_arg_force_ref)

  1. # make
  2. # make install
  3. # cp modules/sqlite.so /usr/lib/php/modules (path to modules folder can be different). Actually, ‘make install’ should copy the extension to appropriate place so this operation might be not required.
  4. You should create a file in /etc/php.d/ named sqlite.ini or add sqlite.so extension directly into php.ini file. Inside write this :

    ; Enable sqlite extension module
    extension=sqlite.so
  5. Restart apache service with

# /sbin/service/httpd restart
or
# /etc/init.d/httpd restart





Update Plesk package using command line, for already created domains.

11 10 2009

echo “SELECT d.name FROM domains d , Limits L JOIN Limits L2 ON L2.id=L.id WHERE d.limits_id=L.id AND L.value=4194304000 AND L2.limit_name=’disk_space’ AND L2.value=52428800″| mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa | while read domname ;

do

/usr/local/psa/bin/domain_pref –update $domname -disk_space 100M -max_traffic 8000M;

/usr/local/psa/bin/domain –update $domname -hard_quota 100M;

done

Using the above command/script we can update the package 50M/4GB bandwidth to 100MB/8GB

In the MySQL query you need to give the vale of 50M as bytes ie 50*1024*1024 and bandowth as 4000*1024*1024.





Hode in Plesk gives blank page after login

9 10 2009

If you are getting segmentaion fault/blank page for horde in plesk, you can check the following steps

1. Log in to the server shell.
2. Issue the following command:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e “replace into misc (param,val) values (’apache_pipelog’, ‘true’);”
3. Rebuild Apache configuration as follows:
# $PRODUCT_ROOT_D/admin/sbin/websrvmng -v -a





Installing memcached in Plesk

8 10 2009

Install libevent:

cd /usr/local/src
wget http://monkey.org/~provos/libevent-1.3e.tar.gz
tar -zxf libevent-1.3e.tar.gz
cd libevent-1.3e
./configure
make
make install

you may need to link /usr/local/lib/libevent to /usr/lib/libevent

wget http://danga.com/memcached/dist/memcached-1.2.4.tar.gz
tar zxvf memcached-1.2.4.tar.gz
cd memcached-1.2.4
./configure
make
make install

which memcached
/usr/local/bin/memcached -d
memcached -d -m 256 -u nobody -p 11211 -l 192.x.x.x (Server IP)

Enabling it in PHP

check zlib is installed in the server.

cd /usr/src
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5
phpize
./configure
make
make install

==========================================

php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

vi /usr/local/lib/php.ini

extension = “memcache.so”

save the file and restart httpd server.

/etc/init.d/httpd restart