Apache Tip : Add a Custom HTTP Response Header

Here’s a handy tip for adding a custom header of your design to every response.

Open your Apache config file (name is usually httpd.conf), usually found in one of these locations (depending on your distro):

/etc/apache2/
/etc/httpd/conf/

Tip: You can also discover the location of this file by executing one of the following:

apache2 -V

or (depending upon your distro):

httpd -V

To find httpd (or apache2, or any other program), use this:

locate httpd

Anyway, to add a header of your choosing to each response, add the following to your config file:

<IfModule mod_headers.c>
        Header set MyHeader "%D %t"
</IfModule>

In the example above, a custom response header named MyHeader is sent along with the value of the current date (%D) and time (%t).

MySQL How-To: Which SQL statements are running right now?

Here’s the basics:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;

Now these results can be a bit daunting, so you might want to refine your lookup — especially if you have at least a vague idea of what your expecting to find:

SELECT * 
FROM INFORMATION_SCHEMA.PROCESSLIST 
WHERE INFO REGEXP 'FROM too_many_rows_why_did_i_do_this';

As you may know, the output is the same as executing the following:

SHOW FULL PROCESSLIST;

However, unlike the above, you can run full SELECT queries against it.

Note: applies only to MySQL versions >= 5.1.17