Archive

Monthly Archives: October 2009

Download the pacakge, their official site is http://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 !!!
Advertisements

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!!!

# 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 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

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.

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

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