The below code is an example of providing some debug information by both email and logging the information to a file in “/var/logs/”. define(“CURRENT_FILE”, “thisfile.php”); define(“LOG_FILE_LOCATION”, “/var/log/”); function log_file($error1, $error2, $file) { $ok = true; // $file = “logile.txt”; if ($fh = fopen($file, ‘a’)) { $ok = true; $conf = “$error1 – $error2\n”; } else…
Month: December 2012
PHP… Do Not Run if running…
If you are creating an application that will be run in the terminal on a Linux machine and you don’t want it to run if its already running you can use the same code below to achieve this. class pid { protected $filename; public $already_running = false; function __construct($directory) { $this->filename = $directory . ‘/’ . basename($_SERVER[‘PHP_SELF’]) . ‘.pid’;…
Asterisk auto-dial out…
Asterisk call files are structured files which, when moved to the appropriate directory, are able to automatically place calls using Asterisk. Call files are a great way place calls automatically without using more complex Asterisk features like the AGI, AMI, and dialplan, and require very little technical knowledge to use. The Asterisk dial plan extensions.conf responds to someone…
Reverse SSH Proxy…
In this guide i have going to talk about how to set up a SSH Reverse proxy. What is a Reverse SSH Proxy. An SSH Reverse Proxy, is where you have a server behind a firewall that you want to access with out the need for port forwarding on routers and firewall. you simply tell…