RSS

Tag Archives: svlinux

How to create .htpasswd?

Create .htpasswd file from commandLine:

# htpasswd -c  /var/www/html/.htpasswd sandeep
New password:
Re-type new password:
Updating password for user sandeep

Add these lines to .htaccess file

## ALLOW ACCESS WITH PASSWORD OR NO PASSWORD FOR SPECIFIC IP/HOSTS ###
AuthType basic
AuthName “Ooops! Temporarily Under Construction…”
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /dev/null
Require valid-user # password prompt for everyone else
Order Deny,Allow
Deny from all
Allow from 192.168.64.5 # Your, the developers IP address
Allow from w3.org # css/xhtml check jigsaw.w3.org/css-validator/
Allow from googlebot.com # Allows google to crawl your pages
Satisfy Any # no password required if host/ip is Allowed

http://www.askapache.com/online-tools/htpasswd-generator/

http://www.php.net/manual/en/features.http-auth.php

http://corz.org/serv/tricks/htaccess.php

 
Leave a comment

Posted by on November 13, 2008 in Linux, php

 

Tags: , , , ,

Weblog Thumbnails

Html2image

Html2image can convert html to bmp, convert html to png and convert html to jpg.

Installation process

1. Download html2image tool
wget http://www.guangmingsoft.net/htmlsnapshot/html2image.i386.tar.gz

2. Extract html2image
tar xvzf html2image.i386.tar.gz
cd html2image
export LD_LIBRARY_PATH=./

3. Run Xvfb
Xvfb :1 -screen 0 640x480x24 -nolisten tcp -audit 4 -auth X1.cfg & export DISPLAY=:1

(virtual framebuffer X server xvfb provides an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.)

4. Convert html 2 image by below command
./html2image http://www.google.com a.jpg

Shell Script to access this tool from command line

#!/bin/bash

cd; cd /opt/html2image

ls

export LD_LIBRARY_PATH=./

#rm /tmp/.X1-lock

./Xvfb :1 -screen 0 1024x768x24 -nolisten tcp -audit 4 -auth X1.cfg & export DISPLAY=:1

./html2image $1 /home/siteroot/public_html/html2image/$2

echo “html 2 image Done!”

PHP script (html_2_image.php)

<?

exec(“export LD_LIBRARY_PATH=/opt/”); // if html2image folder in /opt folder

// here html_2_image is above shell script

exec(“/opt/html_2_image http://www.yahoo.com yahoo.png”, $result, $returnValue);

?>

Execute “html_2_image.php” with cron job, the result image will saved to “/home/siteroot /public_html/html2image/” folder.

 
3 Comments

Posted by on June 20, 2008 in Linux, php, resources

 

Tags: , , , ,