Log to Syslog from PHP
Set the following line in the /etc/syslog.conf file
local0.* /var/log/php.log
Add the following code to your php script
openlog("MessageTag", LOG_PID, LOG_LOCAL0);
syslog(LOG_WARNING,"Static Text: $variable");
closelog();
Make _GET, _POST variables local
php 4.2+ changed the Register Global (register_globals) setting off. This was a good choice. Unfortunately, it can brake applications. It's probably best not to override this setting at the root level, but it's useful to be able to override the setting as the software level:
import_request_variables('P'); //bring $_POST vars into global scope
import_request_variables('G'); //bring $_GET vars into global scope
PHP Constructor with parameters
I had some trouble finding an example of an extended class with a non-null parameter list. I hope this helps you
class Person {
// Class global for name
var $gName;
Person($name) {
$gName = $name;
}
// Accessor Function
getName($name = '') {
if($name != '')
$gName = $name;
return($gName);
}
}
class Employee extends Person {
// Class global for salary
var $gSalary;
// Provide the Person parameters in the Employee contrcuctor
Employee($name, $salary) {
$gSalary = $salary;
$this->Person($name);
}
// Accessor Function
getSalary($salary = '') {
if($salary != '')
$gSalary = $salary;
return($gSalary);
}
}