Categories
howto work

Taking Flight with AngularJs

Lately at work we have been getting into the Flight PHP framework for simple REST-like services with an AngularJS front end. We have had to do a bit of juggling however to get one of the nicer AngularJS features to work: “html5Mode”. Here is what we did.

Categories
security

PHP SuperGlobals: Imperva blowing smoke

Earlier this week, Imperva Data Security Blog posted an article and whitepaper by Amichai Shulman lamenting the continued evils of PHP as a language because of the use of “SuperGlobals”. Here are a few reasons why the article is FUD.

Categories
talk work

tek13 Basic Intrusion Detection Slides

Here is the slide deck for my talk on BasicIntrusionDetectionWithPHPIDS. If you were one of the 19 attendees, please give feedback at Joind.in

Categories
talk

tek13 Uncon Proposal Accepted

My proposal to the phpTek13 Uncon sessions on basic intrusion detection using PHPIDS was accepted! Time to make the slides and live up to people’s expectations…

Categories
howto

OSX PHP 5.5 Beta 1 Build part 2 (Bison)

In my previous post I was trying to get PHP 5.5 beta 1 compiled on my OSX laptop. It turns out that Mountain Lion ships with a version of Bison from 2006. Really Apple? There is a difference between being a hipster and being old. Let’s fix this! If you have not read it already and installed autoconf and git, make sure to do so.

Upgrading Bison:

  1. Go to http://ftp.gnu.org/gnu/bison/ and get 2.6.2. Why not 2.7.1? Because PHP doesn’t support it yet. You would need to manually patch Zend/acinclude.m4 to allow for it.
  2. tar -zxvf bison-2.7.1.tar.gz
  3. cd bison-2.7.1
  4. ./configure –prefix=/usr/local
  5. make
  6. sudo make install
  7. export PATH=/usr/local/bin:$PATH

Now we have a new version of bison in /usr/local/bin. Time to configure php again.

./configure --with-apxs2=/usr/sbin/apxs  --enable-cli --with-config-file-path=/etc --with-libxml-dir=/usr --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar  --disable-cgi --with-curl=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-libedit --with-readline=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets  --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-iconv-dir=/usr  --enable-zip

And it worked! Will it blend?

make
...
Build complete.
Don't forget to run 'make test'.
$

Yes in deed. I made sure to run “make test” as well and not everything passed so I sent in the report. Make sure you do as well.

Categories
howto

OSX 10.8.3 PHP 5.5 pre Build

At the urging of @akrabat at #tek13, I decided to see if I could compile #php 5.5 on my cleanly installed Mountain Lion. Here is how it went.

Categories
sideprojects

nano php highlighting

My personal php.nanorc syntax highlighting settings for future reference.

Categories
sideprojects

Snake Oil Generator Beta

SnakeOilGenerator1I finally got around to an idea I had about 3 years ago when I remembered my Dad’s old medicine chest. Inside there is a classic vial of “Otto’s Cure: The German Remedy”. How fun would a Snake Oil generator be? It turns out, lots of fun, once you load it up with all the historical/hysterical benefits of Snake Oil (and some extra items too).

After collecting a lot of images of actual panaceas, I went digging over at FontSquirrel for some suitable webfonts, and started coding away. At first I thought about using svg for the graphical components. I was quickly dissuaded when I found that browsers still lack support for text wrapping. So, I went back to using  background layers which works pretty well, except for in the randomly generated black boxes, where the text is often the wrong color.

It still needs some work. I have some ingredient lists and other ideas percolating. Eventually I plan on making it customizable. Some of the background images are a tad large as well, causing the initial downloads to be slow. Once they are cached on your browser things go faster.

Try it out, and if you have suggestions, let me know in the comments!

Categories
bug work

ZF1 still can’t parse dates right

I was running into some date validation problems between jQuery datepicker and ZF1. My client wanted one date picker to use a “January 01, 2000” format, and the others a “01/02/2000” format. Seems simple enough.

Zf1_Dates

Categories
howto

Building HyperDex from Git on Ubuntu 12.10

I decided to look in to HyperDex again and found someone beat me to making a php extension. Emboldened to get it up and running for a pet project, I wanted to see if I could build Hyperdex itself from source on my newest Ubuntu 12.10 VM before tackling the php extension.

I followed Göran Krampe‘s install instructions and ran into a few hiccups. He installs a couple libraries we don’t need, and misses python-sphinx as well. Here is my update:

$ sudo apt-get install git autoconf automake autoconf-archive \
libtool python-dev python-pyparsing cython libpopt-dev \
libcityhash-dev g++ libgoogle-glog-dev libleveldb-dev \
bison gperf flex python-sphinx

The rest is mostly the same until the end since we don’t need the python bindings.

git clone git://git.hyperdex.org/po6.git
git clone git://git.hyperdex.org/e.git
git clone git://git.hyperdex.org/busybee.git
git clone git://git.hyperdex.org/replicant.git
git clone git://git.hyperdex.org/HyperDex.git
cd po6 && autoreconf -i; ./configure; make && sudo make install
cd ../e && autoreconf -i; ./configure; make && sudo make install
cd ../busybee && autoreconf -i; ./configure; make && sudo make install
cd ../replicant && autoreconf -i; ./configure; make && sudo make install
cd ../HyperDex && autoreconf -i; ./configure; make && sudo make install

When it came time to test HyperDex out, it showed me no love.

$ hyperdex daemon --help
hyperdex daemon: error while loading shared libraries: libe.so.0: cannot open shared object file: No such file or directory

Looking back through the build spam I see that I need to add /usr/local/lib to my LD_LIBRARY_PATH. Since I want this in my path on boot, lets add it to our ld.so

$ sudo nano /etc/ld.so.conf.d/e.conf

 

#export needed for 'e' library for HyperDex execution
/usr/local/lib

Save it then reload the ldconfig:

$ ldconfig

Now, HyperDex starts up swimmingly:

$ hyperdex daemon --help

Next step: building php-hyperdex!