Dec 21 2007

Elite htaccess hacks

Tag:tepezcuintle @ 3:47

# ELITE HTACCESS FOR WEBDEVELOPERS
##############################################
AuthName “SiteName Administration”
AuthUserFile /home/sitename.com/.htpasswd
AuthType basic
Require valid-user
Order deny,allow
Deny from all
Allow from 24\.205\.23\.222
Allow from w3.org htmlhelp.com
Allow from googlebot.com
Satisfy Any
Each code snippet has been copied from htaccesselite. Additional and detailed info on each htaccess code snippet can be found at askapache.com

NOTE: Most of these snippets can be used with a Files or Filesmatch directive to only apply to certain files.

NOTE: Any htaccess rewrite examples should always begin with:

Continua”Elite htaccess hacks”


Dec 20 2007

Using Wget and Curl With RapidShare

Tag:tepezcuintle @ 21:28

The last days I needed to download a bunch of medical videos which have been uploaded to RapidShare by many other people. Although RapidShare (and all the other 1-click file-hosting services) is very convenient, it has some strict rules for free accounts, for example a guest has to wait for 120 seconds per 1 MB of downloaded data and - to make it worse - no download managers are allowed. Since “waiting” is not a game I like and since I intended to use either wget or curl to download the files, I decided to sign up for a RapidShare Premium account and then figure out how to use the forementioned tools. Fortunately, registered users are permitted to use download managers and, as you will read in the following article, the Linux command line downloaders work flawlessly with a Premier account.

Continua”Using Wget and Curl With RapidShare”


Dec 19 2007

How to collect PHP Errors to help Developers

Tag:tepezcuintle @ 16:29

PHP offers simple but effective solution to log all errors to a log fiie.
On all production web server you must turn off displaying error to end users via a web browser. Remember PHP gives out lots of information about path, database schema and all other sort of sensitive information. You are strongly advised to use error logging in place of error displaying on production web sites. The idea is quite simple -only developer should see php error log.

How do I log all php errors to a log file?

Just add following line to /etc/php.ini to log errors to specified file – /var/log/php-scripts.log

# vi /etc/php.ini
Modify error_log directive
error_log = /var/log/php-scripts.log
Make sure display_errors set to Off (no errors to end users)
display_errors = Off
Save and close the file. Restart web server:

# /etc/init.d/httpd restart

How do I log errors to syslog or Windows Server Event Log?

Modify error_log as follows :
error_log = syslog

How do I see logs?

Login using ssh or download a log file /var/log/php-scripts.log using sftp:
$ sudo tail -f /var/log/php-scripts.log


Dec 19 2007

The magic of the find command

Tag:tepezcuintle @ 15:17

Find

Table of Contents

Continua”The magic of the find command”


Dec 13 2007

Tuning Apache, part 1

Tag:tepezcuintle @ 20:54

Tuning Apache, part 1

There was a link on Digg a couple of days ago to an article about how to tune Apache so as to survive a Slashdotting. After reading it through, I came to the conclusion that the author had no idea what he was talking about. Not only did he admit that he had never experienced the “Slashdot Effect”, but his advice was just plain wrong. I offered a few comments there, but I figured that I should elaborate on a few of them here. I’ll post each major configuration topic as a new blog entry, and today’s entry is about HTTP’s Keep-Alive feature.

Continua”Tuning Apache, part 1″