logging php errors on godaddy hosting
Fri, 07/20/2007 - 12:41 — sandipGodaddys' linux hosting allows for editing your own "php.ini" file and enables support for logging errors, good for debugging purposes when developing with php.
Add the below lines to php.ini in the document root, to log all errors:
error_reporting = E_ALL
log_errors = on
error_log = /home/content/p/a/t/pathto/htm l/error_log
You should also protect the php.ini and error_log file via .htaccess:
<FilesMatch "(error_log|php\.ini)$&qu ot;>
Order deny,allow
Deny from all
</FilesMatch>
- sandip's blog
- Login or register to post comments
tar with Extended Attributes/xattrs support in RedHat 5
Mon, 07/16/2007 - 08:45 — sandipIf using earlier versions, use "star" to backup and restore files with extended attributes. SELinux and ACLs use these Extended Attributes to store the security contexts and access control lists respectively.
Tar has now been rebuilt in RedHat 5 and added support for Extended Attributes.
--selinux Archive the SELinux attributes of the files and directories --acls Archive the ACL attributes of files and directories --xattrs Archive all Extended Attributes of files and directories. This includes both SELinux and ACL attributes, as well as any other xattr.
- sandip's blog
- Login or register to post comments
Finding setuid and setgid files
Sun, 07/08/2007 - 19:46 — sandipsetuid files when executed inherit the permissions of the owner of the file. So having files with setuid of root is a bad idea.
Here's how to find it and unset it.
Note:
There are some system files like at and crontab that have these bits set and is required for it to run.
# find / -perm +6000 -type f -exec ls -ld {}\; > setuid.txt &
To unset it:
# chmod a-s <file>
- sandip's blog
- Login or register to post comments
`yum update kernel` without removing old kernels
Mon, 06/18/2007 - 13:22 — sandipEdit "/etc/yum/pluginconf.d/install
[main]
enabled=1
# this sets the number of package versions which are kept
tokeep=2
- sandip's blog
- Login or register to post comments
Hosting multiple domains pointed to the same web-space
Thu, 05/31/2007 - 16:20 — sandipPlace the snippet of code in an index.php file to pull up a different web page for each domain pointed to the same web-space.
<?
$serverName = $HTTP_HOST;
$serverName = str_replace("www.",& quot;",$serverName);
$serverName = str_replace(".com",& quot;",$serverName);
$serverName = str_replace(".net",& quot;",$serverName);
$serverName = str_replace(".org",& quot;",$serverName);
if (!(empty($serverName))) {
include("./".$server Name.".html");
}
?>
masquerade with iptables
Fri, 05/04/2007 - 23:39 — sandipAllows for easy sharing of internet connection to an internal network with dynamic IP range.
# iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE
Sending mail to a SMTP server using telnet
Fri, 05/04/2007 - 14:15 — sandip$ telnet remotehost 25
HELO localhost
MAIL FROM: johndoe@localhost
RCPT TO: jilldoe@remotehost
DATA
Subject:Test Message
This is a test message.
.
QUIT
RAID notes...
Wed, 05/02/2007 - 12:16 — sandip-
Create RAID-1 level array with 2 active devices and 1 spare:
# mdadm -C /dev/md0 -l 1 -n 2 /dev/hda{8,9} -x 1 /dev/hda10
Note: RAID-1 provides for redundancy and needs a minimum of 2 partitions and any number of spares.
Show details:# mdadm --detail /dev/md0
# mdadm --manage /dev/md0 -f /dev/hda8
Note: When partition is marked faulty, the spare quickly replaces it in RAID 1 array.
Remove:# mdadm --manage /dev/md0 -r /dev/hda8
Note: Only faulty partitions can be removed.
Add:# mdadm --manage /dev/md0 -a /dev/hda8
Note: Only removed partitions can be added.
Stop RAID:# mdadm --stop /dev/md0
# mdadm --assemble /dev/md0 /dev/hda{8,9,10}
Note: Before assembling, check on the UUID of the devices. They should all be the same and show only one array:
mdadm --examine --scan /dev/hda{8,9,10}
# mdadm --zero-superblock /dev/hda{8,9,10}
# mdadm --examine --scan
mdadm --detail --scan
# nohup mdadm --monitor --mail=root --delay=300 /dev/md0 &
Converting bin/cue to iso format
Sat, 04/21/2007 - 22:45 — sandipYou might come across a disc image in the BIN/CUE format. BIN/CUE files can be directly burned to CD via K3B, however if you want to convert to an iso, a command line application called bchunk can be used.
# yum --enablerepo=extras install bchunk
# bchunk image.bin image.cue image.iso
- sandip's blog
- Login or register to post comments
Enabling quotas for users
Fri, 03/23/2007 - 10:58 — sandipCheck to make sure the quota package is installed, else run:
# yum install quota
Edit "/etc/fstab" and add "usrquota,grpquota" to the / partition:
LABEL=/ / ext3 defaults,usrquota,grpquota&nbs p; 1 1
Then run:
# mount -o remount /
# quotacheck -avugm
# quotaon -avugm
To check quotas for all users:
# repquota -a
To edit quota for a particular user:
# edquota -u <user>
Alternately use setquota:
# setquota <softlimit> <hardlimit> 0 0 <user>
- sandip's blog
- Login or register to post comments