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…
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…
MySQL: How do you set up master-slave replication in MySQL? (CentOS, RHEL, Fedora)…
Before we go into how to set up master-slave replication in MySQL, let us talk about some of the reasons I have set up master-slave replication using MySQL. 1) Offload some of the queries from one server to another and spread the load: One of the biggest advantages to have master-slave set up in MySQL…
Domain Redirection using Apache mod_rewrite and .htaccess
I recently acquired some domains and finally got around to adding them to my server. Instead of them being their own sites (well, point to my primary site, but the URL in the browser address bar is taken over by the new domain name), I wanted them to redirect to my primary domain (phillipcooper.co.uk). If…
m0n0wall 1.34 released
There are ready-made binary images for embedded computers from Soekris Engineering and PC Engines, a CF/IDE HD image for most standard PCs (other embedded ones may work, too) with either keyboard/monitor or serial console, a CD-ROM (ISO) image for standard PCs, a VMware image, as well as a tarball of the root filesystem. Refer to…
Some Simple PHP code..
Below i am going to list some simple PHP code that makes up most of a PHP coded page. If..Elseif…Else… statments $something = “Cat”; if ($something==”Cat”) { print “Cat\n”; } elseif ($something==”Dog”) { print “Dog\n”; } else { print “Dont know\n”; Explode…foreach $ex = “cat:dog:mouse:goose”; $explode = explode(“:”, $ex); foreach ($explode as $exploded) { print…
Manually Configuring a Multicast Paging Ring Group to work with Yealink T20, T22, T26, T28, T32, T38
Be aware that different firmware versions may have different web interface formats and functionality. For further support, please visit Yealink here From 3CX Phone System Ring groups can be used to facilitate multicast paging. Note that 3CX Phone System facilitates multicast paging along the address range: 224.0.0.0 – 224.0.0.255 and port range which is not already…
Cat Linux Command
The cat Linux command is used to display file contents, for example if I quickly wanted to see the contents of a text file I would use the cat command to dump the output to the console or pipe it to another command. Situations when the cat Linux command would used How To dump the…