‘Technology’ Archive

Misleading PHP Error

5 September 2010 20:53

Having done some upgrades to my server (PHP, apache) I noticed I was getting some odd errors in the apache log and one of my PHP based sites wasn’t loading. The error in the log was:

[Sun Sep 05 20:23:40 2010] [error] [client X.X.X.X] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Now having done some digging everything suggested the rewrite rule was wrong, or, behaving differently after the upgrade but it turned out that the problem was in fact PHP short_open_tag related.

My php.ini had short_open_tag = Off (which it should, but the site in question was a quick one). Changing that to On and giving apache a restart made the problem go away. When I get a chance I will make the <? tags <?php but it’s not a biggy right now.

For more on short_open_tag check the manual.

Filed: Technology // Tagged: , , // No Comments

MySQL 5.1 on CentOS with yum

30 August 2010 17:43

Not a particularly exciting first post back after so long with nothing but hopefully it’s useful none the less. On a CentOS box you can’t get MySQL 5.1 or PHP 5.3 easily from yum. Luckily a chap known as remi as a handy repo that contains both said packages.

To get the repo running you’ll need to install a couple of RPM’s:

epel-release-5-4.noarch.rpm
remi-release-5.rpm

To install them:

rpm -Uvh epel-release-5*.rpm remi-release-5*.rpm

After that jump into /etc/yum.repos.d where you should now have a remi.repo file. Edit that and change enabled=0 to enabled=1 and you’re good to go. Do a yum check-updates and install away.

Filed: Technology // Tagged: , , , // No Comments

iPhone Antenna Song

3 August 2010 8:26

Amusing song on about the iPhone antennagate from a guy who sings videos. It’s quite amusing.

Filed: Technology // Tagged: , // 1 Comment

Simplicity with o2

26 April 2010 23:23

If you’ve got yourself an iPhone, particular a 3G, odds are you’re out of, or, coming up to being out of contract. You’re probably paying £35/m right now as well. If like me you’re holding on for June/July to see if a new iPhone is launched, which, it probably will be you’re not going to want to jump into a 18/24 month contract to upgrade to a 3GS (albeit tempting). O2 actually seem to have an answer in their reasonable new Simplicity SIM only tariffs. For £20/m you can get unlimited texts and 300 minutes inclusive.

It’s also really easy to switch online once you’ve found the right links. If you click on the “Shop” dropdown at the top you’ll see an Upgrade Your Phone link. Follow that, enter your mobile number and then the code you’ll get by SMS. Once in you can pick from the don’t want a phone section and just pick the new tariff. You can also just go on a month to month rolling contract which is great, saves you money and hopefully makes you ready for the iPhone 4G. You can also “downgrade” to these tariffs and save £5/m if you go for a 12 month contract.

I’ve gone through the process just now and as yet not received a confirmation email but hopefully that’ll turn up soon!

Edit: Still no email but now the O2 iPhone app shows I’m on to simplicity 20 tariff.

Filed: Personal, Technology // Tagged: , , , // No Comments

MySQL and 0x0B

23 April 2010 12:01

You may or may not know about the wonderful vertical tab character 0x0B. It’s a character that’s not easy to see and can cause issues across a number of different programming languages. In my case a Rails developer was having trouble passing some data from an API. A JSON parser was throwing errors about a specific character. Originally we suspected line breaks were causing the issue but after more digging and examination using Textmate and the Text bundle we spotted the invisible characters and having converted it to hex found out it was 0x0B. A quick Google brings back quite a few results of people having the same problem.

In order to find them in the database I knocked up the following SQL:

SELECT * FROM table WHERE data LIKE CONCAT('%',CHAR(0x0B),'%');

Then to replace them quickly (assuming the 3 records have ID’s 1,2 and 3):

UPDATE table SET data = REPLACE(data,CHAR(0x0B),'') WHERE id IN (1,2,3);

Filed: Technology // Tagged: , , // 1 Comment

Tweeting from the command line

21 April 2010 17:22

I read an article over at OS X Daily about posting a tweet from the command line using the twitter API. Taking this one step further here’s a handy little script that’ll even stop you posting nothing and stuff that’s too long.

#!/bin/bash
TWEET=$1
TWEETLEN=${#TWEET}
if [ $TWEETLEN -eq 0 ] || [ $TWEETLEN -gt 140 ]; then
	if [ $TWEETLEN -gt 140 ]; then
		let EXTRA=$TWEETLEN-140
		echo "Usage: tweet \"message\" (140 chars or less, you're $EXTRA over)"
	else
		echo "Usage: tweet \"message\" (140 chars or less)"
	fi
	exit 1
else
	curl -u username:password -d status="$1" http://twitter.com/statuses/update.xml
fi
exit 0

Save the file as “tweet” and make sure it’s in the path with executable permissions of 755.

chmod 755 tweet

Filed: Technology // Tagged: , , // 2 Comments

Phatnoise

6 February 2010 15:56

First blog post in a while, but, here goes anyway!

I’ve got a Phatnoise MP3 system in my Golf and have had the same music on the cartridge for ages. The problem is the company who make it don’t really seem to be around to much and I think have been acquired by Harmon. Either way if you need the latest version of the Phatnoise music / media manager I suggest you go check out this post on a very handy forum!

Filed: Technology // Tagged: , , , , // No Comments

Asynchronous Tracking with Google

2 December 2009 13:43

Google Analytics has had its latest update by now allowing asynchronous tracking cools. Pretty neat and also useful if you’re suffering or concerned on page load times. Interesting to see how it would work with multiple GA accounts, but, in theory should be easy to tweak.

http://code.google.com/apis/analytics/docs/tracking/asyncTracking.htm

Filed: Technology // Tagged: , , , // 1 Comment

Ruby Enterprise Install

9 November 2009 13:31

Trying to install Ruby Enterprise on a fresh RHEL5 64 bit box this morning and hit a few issues. Initially just the standard install requests for gcc, gcc-c++, readline-devel, openssl-devel and zlib-devel. They all installed fine, but, when I tried running the installer I got an error like this:

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm:65,
from src/tcmalloc.cc:112:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:64:28: error: bits/c++config.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:69,
from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm:65,
from src/tcmalloc.cc:112:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45:29: error: bits/c++locale.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:46:25: error: bits/c++io.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory:54,
from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h:64,
from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:66,
from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm:68,
from src/tcmalloc.cc:112:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h:52:31: error: bits/c++allocator.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:45,
from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string:52,
from src/base/commandlineflags.h:52,
from src/tcmalloc.cc:114:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h:38:30: error: bits/atomic_word.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h:82: error: expected template-name before ‘&lt;’ token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h:82: error: expected `{' before ‘&lt;’ token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h:82: error: expected unqualified-id before ‘&lt;’ token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: In function ‘void std::random_shuffle(_RandomAccessIterator, _RandomAccessIterator)’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:1906: error: ‘rand’ is not a member of ‘std’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h:44: error: expected constructor, destructor, or type conversion before ‘__exchange_and_add’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h:48: error: expected ‘,’ or ‘...’ before ‘*’ token
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:150: error: ‘_Atomic_word’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: In member function ‘void std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::_Rep::_M_dispose(const _Alloc&amp;)’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:232: error: ‘__exchange_and_add’ is not a member of ‘__gnu_cxx’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: In member function ‘typename _Alloc::rebind&lt;_CharT&gt;::other::size_type std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::_M_check(typename _Alloc::rebind&lt;_CharT&gt;::other::size_type, const char*) const’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:306: error: there are no arguments to ‘__N’ that depend on a template parameter, so a declaration of ‘__N’ must be available
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:306: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: In member function ‘void std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::_M_check_length(typename _Alloc::rebind&lt;_CharT&gt;::other::size_type, typename _Alloc::rebind&lt;_CharT&gt;::other::size_type, const char*) const’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:314: error: there are no arguments to ‘__N’ that depend on a template parameter, so a declaration of ‘__N’ must be available
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: In member function ‘typename _Alloc::rebind&lt;_CharT&gt;::other::const_reference std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::at(typename _Alloc::rebind&lt;_CharT&gt;::other::size_type) const’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:726: error: tnction ‘typename _Alloc::rebind&lt;_CharT&gt;::other::const_reference std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::at(typename _Alloc::rebind&lt;_CharT&gt;::other::size_type) const’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:726: error: there are no arguments to ‘__N’ that depend on a template parameter, so a declaration of ‘__N’ must be available
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: In member function ‘typename _Alloc::rebind&lt;_CharT&gt;::other::reference std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::at(typename _Alloc::rebind&lt;_CharT&gt;::other::size_type)’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:745: error: there are no arguments to ‘__N’ that depend on a template parameter, so a declaration of ‘__N’ must be available
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: In static member function ‘static _CharT* std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::_S_construct(_InIterator, _InIterator, const _Alloc&amp;, std::forward_iterator_tag)’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc:145: error: there are no arguments to ‘__N’ that depend on a template parameter, so a declaration of ‘__N’ must be available
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: In static member function ‘static typename std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::_Rep* std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::_Rep::_S_create(typename _Alloc::rebind&lt;_CharT&gt;::other::size_type, typename _Alloc::rebind&lt;_CharT&gt;::other::size_type, const _Alloc&amp;)’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc:533: error: there are no arguments to ‘__N’ that depend on a template parameter, so a declaration

The fix was two steps, first a simple install of libstdc++-devel then follow the instructions to install tcmalloc which is required. Odd that on a 32 bit system it installed straight away.

Filed: Technology // Tagged: , , , // No Comments

MSIE SSL Oddness

16 October 2009 15:09

Internet Explorer strikes again, sometimes. In Chrome, Firefox and Safari the problem doesn’t present. On a couple of webservers in a cluster we recently noticed the following type of error being returned randomly on images, CSS and JavaScript files when calling the page via SSL.

GET ERROR_INTERNET_SECURITY_CHANNEL_ERROR image/gif https://www.domain.com/path/to/image.gif

Now the majority of our SSL certificates for the site in question are server out via a SSL accelerator on our Cisco LBAL’s but this site wasn’t. It was still using a cert on the local box. Having dug deeper I noticed that a couple of the servers had the following lines of code in whereas all the others didn’t. Due to the load balancing that solves the randomness side of it.

AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog builtin
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

Something in those lines of code causes the issues, I’m stabbing in the dark that it’s the session cache as none of the others would seem to be causing the problem. I’ve not tried line by line to find the offender.

Hopefully that will help someone out as I found lots of results in Google but not many solutions!

Filed: Technology, Work // Tagged: , , , , // No Comments

 
What's ianteresting?   •   Twitter   •   About   •   Contact
©2012 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset