Author: Michael Blood
This webpage is not available ERR_CONTENT_DECODING_FAILED – PHP ob_start() ob_gzhandler – Trailing spaces after closing ?> in WordPress Plugin
This webpage is not available ERR_CONTENT_DECODING_FAILED – PHP ob_start() ob_gzhandler – Trailing spaces after closing ?> in WordPress Plugin
Recently we ran into an issue where a website would not load. We traced the problem to a line in the code which attempted to pass all content to ob_start(‘ob_gzhandler’).
This basically words to zip up all content and send it to the browser. However an error was being thrown ERR_CONTENT_DECODING_FAILED, which showed up in the browser window and in the browser console. After some detailed debugging in PHP using some die commands()
die("die: ".__FILE__.":".__LINE__);
I found that the issue came from an rogue blank character which displayed before the ob_start(“ob_gzhandler”) function could be called.
There were a couple of ways I could deal with this, first I could simply put an ob_start() at the top of the code, and then put an ob_get_clean(); just before the ob_start(‘ob_gzhandler’), however this felt a bit sloppy, so I went in search of the rogue character.
The application that this was in, was one that simply included the wordpress load file so that it could integrate with a WordPress installation, and I found that the characters was coming from the WordPress install. Using a hunch I decided d to look for a recently updated plugin and I quickly found a plugin that had an end php tag “?>” with an extra line after it.
I quickly fixed this and then decided I would figure out a way to quickly identify issues like this. While there are many ways to address this and figure out how to over come it, the issue seems to identify an need to figure out whether plugins conform to some best practices (such as omitting a closing ?> php sign)
If we identify this need, we will write a free plugin to put on the WordPress site, which will go through all plugins on sites to confirm that they use some best practices such as this.
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration – enable apache ssl module
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration – enable apache ssl module
If you are moving an existing Apache configuration file from one server to another, or if you are enabling SSL configuration on an existing website, you could run into this error as you restart apache
server#/etc/init.d/apache2 restart Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
This essentially means that Apache doesn’t understand what the SSLEngine command means. This is most likely because SSL has not been enabled on this server. For quite some time SSL has come with Apache2 by default, however you do still have to enable it.
To enable it you can simply run enable the ‘ssl’ apache module the command
#a2enmod ssl #/etc/init.d/apache2 reload #or #/etc/init.d/apache2 restart
The error should no longer show a the SSLEngine command is correctly recognized by the ssl mod.
Find out which PHP packages are installed on ubuntu / debian
Find out which PHP packages are installed on ubuntu / debian
As we have moved or upgraded sites from one server to another, sometimes we have needed to know which PHP5 dependencies were installed on one server servera, so that we could make sure those same dependencies were met on another server serverb
To do this we can run a simply command line tool on server a
servera# echo `dpkg -l|awk '$1 ~ /ii/ && $2 ~ /php5/{print $2}'`
libapache2-mod-php5 php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-pgsql
and then we copy the contents of the output and past it after the apt-get install command on serverb
serverb# apt-get install libapache2-mod-php5 php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-pgsql
Dont forget to reload apache as some packages do not reload it automatically
serverb# /etc/init.d/apache2 reload
Utility CSS Stylesheet finding duplicate selectors and declaration differences
Utility CSS Stylesheet finding duplicate selectors and declaration differences
Occasionally we run into a style sheet which has not been managed well and has duplicate style block and style definitions.
When this happens it can be difficult to evaluate which style blocks are duplicated, and which ones are still in use.
CSS Validators do not do a good enough job at identifying the duplicates and allowing me to make decisions on how to merge discrepancies.
So we came up with a utility that helps us to evaluate the duplicate selectors. The utility is here:
To use it we can simply paste in a giant style sheet block, or type in the url of the css and it will download it. Downloading it can be useful as you fix your style sheet and want to know how it looks.
The output of the utility is an ordered list of all of the selectors, in the case where there are duplicate selectors, the duplicated attributes are highlighted, if the value in the attribute is duplicated that shows red, if it is unique, it shows blue.
http://www.webuildplugins.com/css-stylesheet-evaluator/
The utility does not attempt to resolve the issues, it simply highlights the duplicates to potentially help you identify the issues.
The utility does not attempt to recognize which classes may override each other.
Future enhancements to this tool may include
- the ability to download multiple style sheets – to help identify styles that may clobber eachother.
- the ability to paste in an html block or url which then extricates the css style blocks and linked style sheets to help identify clobbering or duplicated selectors
- a utility which combines unique attributes from multiple duplicated selectors and gives a copyable text block with the combined text.
In addition to the need we have while building websites or taking over other customer sites, this too highlights our ability to build custom plugin utilities within WordPress. We also sell this WordPress plugin to customers that may need it.
Utility – Bulk Convert the Unix Timestamp in log messages To a Readable Date
Utility – Bulk Convert the Unix Timestamp in log messages To a Readable Date
I have often run into the need to convert a large list of timestamps from Unix Timestamp to a readable date.
Often times this is simply a need that I have when receiving an error message from a server, or when reviewing log files which only use Unix Timestamps.
So I created a simple utility, just paste in your text from the log file, the utility will search out the string for timestamps listed as the first part of each line, and convert the timestamp to a date.
While this might be useful at some point as an automated process, for now I just use it when I need it.
I am documenting the tool here with a link for myself (or any one else that may need it) so that it is simple to find.
http://matraex.com/batch-timestamp-to-date.php
Possible future upgrades to this utility will likely search out Unix Timestamps anywhere in the text and convert them, instead of just at the first of the line.
9th Annual Matraex River Trip – Photos
9th Annual Matraex River Trip – Photos
On the 25th of July the Matraex crew all headed back to Cascade Raft and Kayak for this years River Trip.
Mac, Jeff, Jeremy, Parker and Vlade all rode the rafts, Michael showed up but wimped claiming ACL surgery recovery. Most of the team had been on a previous river trip, but this was Parker’s first time.
Every one had a good time and there were lots of pictures. Most of the team wore the T-Shirts which Jeremy designed last month (Jeremy one the T-Shirt design contest and got two extra shirts out of it)
Some Smiles and Action as the Matraex team faces challenges
9th Annual Matraex River Trip – Google Photo Album
Michael Photobombing
When building an alexa skill – some gotchas with understanding workds
When building an alexa skill – some gotchas with understanding workds
When building an alexa skill there are some gotchas with Alexa understanding some words
- Words with repeated consonants seem to have a problem, such as papaya.
- Be sure to instruct the speaker to speak strong an clear
- Slow speakers may get cut off before they finish there phrase, instruct speakers to speak fast to make sure Alexa does not cut them off.
ColdFusion: SQL Server – Cannot use empty object or column names. Use a single space if necessary
ColdFusion: SQL Server – Cannot use empty object or column names. Use a single space if necessary
When upgrading from an OLD version of Coldfusion to a newer one. We would occassionally receive the message
Cannot use empty object or column names. Use a single space if necessary
This message seemed as though it came from an error sent back from the database but the database version did not change at all.
However CF changed their version of SQL Server driver as the progressed and made it more compliant. Basically they made it so that you could no longer use double quotes (“”) in order to enclose an empty string.
So the SQL query that may have worked before
select * from myusers where username <> “”
would need to become
select * from myusers where username <> ”
proftpd stops running – once a week when logrotate.d runs
proftpd stops running – once a week when logrotate.d runs
On Sunday mornings at 6:30AM I receive this log entry at the bottom of my /var/log/proftpd/proftpd.log file and proftpd stops running
2015-07-05 06:28:24,870 servera proftpd[31258] 127.0.1.1: ProFTPD killed (signal 15) 2015-07-05 06:28:24,871 servera proftpd[31258] 127.0.1.1: ProFTPD 1.3.5rc3 standalone mode SHUTDOWN
The time (about 6:30AM) on sunday leads me to know from experience that is when the log files rotate if they are set to rotate weekly using logrotate.
So I go in search of the logrotate commands for proftpd with grep and find the following file
#grep proftpd -l /etc/logrotate.d/*
/etc/logrotate.d/proftpd-basic
Inside of /etc/logrotate.d/proftpd-basic file, there is a command which restarts proftpd after the logs files are rotated
postrotate
# reload could be not sufficient for all logs, a restart is safer
invoke-rc.d proftpd restart 2>/dev/null >/dev/null || true
When I run this at the CLI, I find that every other time I run the command, proftpd does not start! This seems to me to be a timing issue, so I simply but a sleep command between the stop and start commands in the restart script
/etc/init.d/proftpd force-reload|restart) if [ "x$RUN" = "xyes" ] ; then signal stop 1 sleep 1 #ADDED BY Michael Blood to avoid a timing issue that would not allow the start if the stop did not complete. start
This appears to fix the problem perfectly.
9th annual Matraex River Trip – Tshirt Design Contest Winner
9th annual Matraex River Trip – Tshirt Design Contest Winner
3 Designs were entered into the 9th annual Matraex River Trip – Tshirt Design Contest by Matraex employees. The designs were printed out and everyone voted by SurveyMonkey.
The winner was….. Jeremy Trull with this design.
Jeremy wins bragging rights and two additional T-Shirts.
We are now orderings shirt so they show up in time for the River Trip scheduled for the 25th of July.