Archive for the ‘Programming’ Category

Spell check your website with Firefox

I came across a little trick today to spell check a website you are browsing in Firefox.  It’s pretty handy if you have a live site and want to give it a once over without loading up all of your code.  To spell check the page just go to it, then paste this in the […]

Fix CSS Browser Compatibility using conditional comments

I’ve never had any incompatibly issues with different browsers whilst working on websites before – until today. For some reason IE7 decided it wanted totally misjudge my margins by about 30 pixels – totally distorting the site. Strange how it worked fine in any other browser (Including IE6 and IE8!). Anyway, conditional comments can be […]

List Perl modules installed

Handy command to list all Perl modules installed. perl -MFile::Find=find -MFile::Spec::Functions -lwe ‘find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC’

PHP 5.3 big changes!

Lots and lots of things are deprecated!  Probably a good idea to change the error reporting to something like: error_reporting = E_ALL & ~E_NOTICE ~ E_DEPRECATED magic_quotes_gpc,register_globals,safe mode seem to be deprecated Short PHP tags are disabled by default: short_open_tag = On more to come I’m sure…….

xpdf and antiword test scripts

xpdf and antiword test scripts.  xpdf is now part of the poppler and poppler-utils packages <HTML> <BODY> <PRE> <?php $return_code = 0; $result = array(); $error = exec(‘/usr/bin/pdftotext /var/www/vhosts/mydomain.com/httpdocs/xpdftest2.pdf’, $result, $return_code);

PHP sends mail as anonymous@servername

The from address is not enforced.  This can cause some PHP formmail script emails to be treated as spam.  Fix: 1) add a -f(sender address) parameter: mail($to, $subject, $message, $headers, ‘-fsomeone@somewhere.com’); 2) add a Return-Path header: mail($to, $subject, $message, ‘Return-Path: someone@somewhere.com\r\nFrom: someone@somewhere.com’); Qmail is *meant* to check for the from address field in Sender, From, […]

PHP IMAP SSL error

if you are getting a certificate error when using the PHP IMAP function, add the /notls flag: ie: $mbox = imap_open (“{localhost:995/pop3/notls}”, “user_id”, “password”);

PHP file manager not working after upgrading to PHP 5.2

posix is not included with php 5.2 and above do a yum install php-process

osCommerce broken after PHP/MySQL 5upgrade

osCommerce doesn’t seem to be very compatible with MySQL 5 and will most likely generate a load of errors from its SQL statements. Upgrading to the latest version is recommended and should fix this.  For heavily modified versions this may not be posible and will require some hacking to fix: add () to from tables […]

Encrypted email script using GPG and PHP

#First grab the public key into a file for the GPG enabled email address and import it into a new keyring called public_key.gpg mkdir .gnupg to add the keyring files.  Probably outside httpdocs would be a good idea! gpg –no-default-keyring –keyring /var/www/vhosts/secure.mydomain.com/httpsdocs/mydomain.com/.gnupg/public_key.gpg  –import public_key #you can list keys in the keyring by: gpg –no-default-keyring –keyring […]