Archive for the “Linux Maintenance” Category

PERL: blank page or 500 error

Possible error in the logs or blank page
malformed header from script Bad Header

You will need to add
print “Content-type : text/html\r\n\r\n”;

to your script unless your using the cgi module

use cgi;

Here is a sample script
#!/usr/bin/perl -w
##print "Content-type : text/html\r\n\r\n";
#use CGI;

#print "mas\n";

use CGI; # load CGI routines
$q = new CGI; # create new CGI object
print $q->header, # create the HTTP header
$q->start_html('hello world'), # start the HTML
$q->h1('hello world'), # level 1 header
$q->end_html; # end the HTML

CGI Module

August 9, 2009 Posted Under: Linux Maintenance   Read More

Linux: copy files based on a user

The script is incomplete but can be tweaked to meet your needs

find /root/ -user apache -print | \
while read file
do
cp "$file" /root/test1/`"$file"`
done

August 8, 2009 Posted Under: Linux Maintenance   Read More

Verify Zend Optimizer is working

Code to verify if Zend Optimizer is installed
<?
// TEST ZEND OPTIMIZER
ob_start();
phpinfo(INFO_GENERAL);
$output = ob_get_contents();
ob_end_clean();
$output = str_replace(array("&gt;", "&lt;", "&quot;", "&amp;", "'", "&nbsp;"), array(">", "<", "\"", "&", "'", " "), $output);

if (strstr($output, "Zend Optimizer")) {

// GET ZEND VERSION NUMBER
$version = split("Zend Optimizer",$output);
$version = split(",",$version[1]);
$version = trim($version[0]);
//$version = "v2.5.4";

if (!strstr($version,"v")) {
$zend = "Zend Optimizer Detected - Unknown Version";
$zendColor = "Blue";
$version = "0";
}
else {
$version = str_replace("v","",$version);

$version = explode(".",$version);
$subVersion = $version[2];
$dummy = array_pop($version);
$version = implode(".",$version);

if (($version > "2.5") || ($version=="2.5" && $subVersion>5)) {
$zend = "Pass";
$zendColor = "green";
}
else {
$zend = "Fail - Installed Version: ".$version.".".$subVersion;
$zendColor = "red";
}
}
}
else {
$zend = "Fail - Zend Optimizer Not Detected";
$zendColor = "red";
}
?>
<strong>Zend Optimizer</strong></span>
</td>
<td bgcolor="#F3F3F3"><strong><font color=<?php echo $version ?>><?php echo $zend ?></font></strong>
<?php
if ($zend!="Pass") {?>
<p><em>Zend Optimizer must be Version 2.5.5 or greater! Ask your web host provider if you are unsure. The latest version of Zend Optimizer can be downloaded from <a href="http://www.zend.com/store/products/zend-optimizer.php" target="_blank">www.zend.com</a>. </em></p>
<?php } ?></td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#274A72"><?php
?>

August 1, 2009 Posted Under: Linux Maintenance   Read More

Linux:Too many levels of symbolic links

Error :
/usr/bin/perl: bad interpreter: Too many levels of symbolic links

This error means you have a symbolic link ..linking to another symbolic link .. causing a loop..

In my care .. lol .. perl wasnt installed.

August 1, 2009 Posted Under: Linux Maintenance   Read More

Plesk: changing php settings within htaccess

Example :

Turning display errors can be accomplish by adding the following code to your script
ini_set(‘display_errors’, 1); error_reporting (E_STRICT | E_ALL);
ini-set
Manual PHP changes
Parallels KB

May 17, 2009 Posted Under: Linux Maintenance   Read More