June 3, 2013

PHP Composer error - cannot redeclare class

I rebuilt PHP last night to include APC and all of a sudden composer stopped working in my project. Whenever I ran a simple update, install or dump-autoload I’d get: $ composer update PHP Fatal error: include(): Cannot redeclare class symfony\component\process\process in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 183 Fatal error: include(): Cannot redeclare class symfony\component\process\process in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 183 A quick google told me others also had the same issue. ... Read more

June 2, 2013

Installing APC in PHP 5.4.x on Mac OSX

I recently installed PHP 5.4 from source but needed to add APC. Most people can install this using PECL, but I got an error doing this: $ pecl install apc Warning: lstat(): Lstat failed for /private/tmp/pear/cache/497e483d585c1e3f341260e73a8c6e85rest.cacheid in PEAR/REST.php on line 276 Warning: lstat(): Lstat failed for /private/tmp/pear/cache/497e483d585c1e3f341260e73a8c6e85rest.cacheid in /opt/php-5.4.15/lib/php/PEAR/REST.php on line 276 No releases available for package "pecl.php.net/apc" install failed So instead I downloaded the APC source from the PECL website and ran the following: ... Read more

June 1, 2013

base16 - colour scheme for hackers

I came across a great set of colour schemes called base16. From the website: Base16 provides carefully chosen syntax highlighting and a default set of sixteen colors suitable for a wide range of applications. Base16 is both a color scheme and a template. There are repos for the following tools: Base 16 Builder Vim Shell iTerm2 TextMate OSX Color Palette Xresources Mou XFCE4 Terminal Gimp Palette Gnome Terminal Emacs Geany There’s even a builder so you can roll your own theme! ... Read more

May 29, 2013

Installing Xdebug on Mac Mountain Lion (10.8.3)

Even though I’m running Mountain Lion (10.8.3) which comes with Xdebug I couldn’t get the PHP (5.4.14) local web server to register that Xdebug was actually installed and enabled. My php.ini had the already installed Xdebug extension enabled: zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so" But whenever I inspected phpinfo() there wasn’t any mention of Xdebug. Luckily the website has a wizard where you can paste the output of phpinfo(). From there you get detailed instructions on how to download, configure and make the latest version of Xdebug. ... Read more

May 22, 2013

MySQL thread_stack overrun error

We added a trigger to MySQL (v5.5.28) recently that was a simple UPDATE on table column, when a target table was UPDATEd. It ran fine (as expected) on our development environment but not when we pushed the changes to staging. The error being thrown by MySQL was: Thread stack overrun: 8304 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack. Querying the database told me that the current _threadstack setting is 128K: ... Read more

May 9, 2013

iOS 6 caching POST requests

Apparently I’ve been living under a rock, never having been bitten (that I know of) by the pretty massive bug Apple rolled out in iOS 6 (with Safari). The bug has been well documented around the interwebs, basically Safari caches HTTP POST requests. If you haven’t heard about this…stop and read that last bit again. Now, replicating this bug is dependent on the payload of the POST not changing between requests, so in many circumstances you may be fine. ... Read more

May 8, 2013

Migrating from bitbucket to github

Migrating repositories between bitbucket and github couldn’t be simpler thanks to the design nature of DVCS like git because the entire history is already located on your machine within your projects .git folder. All you’re really doing is changing a remote. Open a terminal and navigate to your project directory. TLDR; For those who just want the commands with no explanation git remote rename origin bitbucket git remote add origin git@github. ... Read more

May 6, 2013

Date timezone error when upgrading to PHP 5.3+

I upgraded to 5.4.14 last night on Mac OSX 10.8.3. Things went smoothly except I got an error running my apps: date(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date. ... Read more

May 6, 2013

Installing PHP 5.4+ from source on Mac OSX Mountain Lion

Download and extract the PHP source from php.net, for me that was 5.4.14. Put it somewhere friendly, the desktop will do. Open a terminal and install some dependancies via brew: brew install libjpeg brew install pcre brew install libxml2 brew install mcrypt Download and install ICU from http://site.icu-project.org/download/48#ICU4C-Download tar xzvf icu4c-4_8_1-src.tgz cd icu/source ./runConfigureICU MacOSX make sudo make install Rebuild IMAP, download source from ftp://ftp.cac.washington.edu/imap/ make osx EXTRACFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" sudo cp c-client/*. ... Read more

May 5, 2013

Stopping a remote process after killing an ssh session

I often want to tail log files on remote server(s) when running diagnostics for an application. You can either login to the remote server via an SSH session, then execute the tail command. Or you can do it from a local shell (without explicitly logging onto the remote server first). That’s pretty simple: ssh myRemoteServer tail -f /path/to/logs/myapp.log The problem here, is when you ctrl-c out of this command to kill the tail, the process is still running on the remote machine. ... Read more

© Michael Sharman 2017