MySQL IF Statement Affect On Speed

if(`table`.`start`='0000-00-00','',`table`.`start`)

That’s the part of my query that was increasing the execution time by 10x.

I changed it to just `table`.`start` (without the IF statement) and the query was 10x faster.

Twilio PHP Library Using A Proxy

Updated 2026-09-26: reworked for current twilio-php.

Back in 2013 this meant patching a CURLOPT_PROXY line into the library’s TinyHttp.php, and I asked for a proxy option in twilio-php#144. Current twilio-php’s CurlClient takes an array of curl options, so put the proxy there and pass the client to Client as its fifth argument:

<?php
require __DIR__ . '/vendor/autoload.php';

use Twilio\Http\CurlClient;
use Twilio\Rest\Client;

$httpClient = new CurlClient([
    CURLOPT_PROXY => 'http://192.0.2.10:8080',
    CURLOPT_SUPPRESS_CONNECT_HEADERS => true,
]);
$twilio = new Client($sid, $token, null, null, $httpClient);

CURLOPT_SUPPRESS_CONNECT_HEADERS keeps the proxy’s reply to CONNECT out of the response. CurlClient only strips that reply when it’s a bare status line, so a proxy that adds headers to it, like tinyproxy, breaks response parsing without the option.

Failed to connect to socket /var/run/dbus/system_bus_socket

Error: Can’t find out if NetworkManager is running: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory.

The following fixed the problem:

apt-get install dbus

(if you already have dbus installed: sudo service dbus start)

/etc/init.d/network-manager start

What caused the error?:

/etc/init.d/network restart

Could not initialize NMClient

** (process:17986): WARNING **: error: could not connect to NetworkManager

Fix: Try running with sudo.

For example: sudo nm-tool | grep DNS

Crontab Mistake

I wanted to run a script every 20 minutes, so I put this into my crontab:

20 * * * * sh script.sh

That’s wrong. That only runs it once every hour 20 minutes into the hour. For example, 20,40 * * * * sh bash.sh would run it twice - 20 and 40 minutes into the hour.

To run the script every 20 minutes like I was expecting:

*/20 * * * * sh script.sh