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!

Categories
work

AngularJs Zend Framework 1 Resource Plugin

I whipped up a simple ZF1 resource plugin for AngularJs called AngularZF1 and dropped it onto github. We have started using Angular at work and I thought, why not mimic how the ZendX_JQuery plugin works. Right now it doesn’t add much beyond just adding the script tag to your <head>. Enjoy, all you who are still on ZF1!

Categories
work

Oracle in PHP Frameworks

I have been using Zend Framework 1.x at work for some time now. I appreciate the large number of components, many of which my system uses on a daily basis. Yes, it is a large library, but we have a very large application that probably does too many things.

ZF2 is coming out soon and it seems quite different from 1.x. I downloaded the betas and skeleton app, and looked at the well written tutorials, but I am still having a difficult time wrapping my mind around it. So I have decided to see if the grass is greener elsewhere. There are plenty of PHP frameworks out there to choose from, but I have one particular requirement: Oracle support. I work in a somewhat regulated space and the big vendors are preferred over the Open Source databases. And not just any Oracle support, we need to use the oci8 driver.

Most of the new frameworks prefer to use PDO for their database abstraction layer. This is fine for most people who are using MySQL or PostgreSQL. This is not great for us Oracle users. Although there is a pdo_oci extension, it is very buggy. We have to use the oci8 driver instead. And no, I cannot just switch to MySQL.

So, which of the frameworks support oci8? *feel free to correct me in your comments

Framework DBAL oci8 Notes
ZF 1.x Internal  Y
CodeIgniter 2  Y
Symfony2 Doctrine  Y  According to the Doctrine 2.0x docs oci8 is supported.
ZF2 Internal/Doctrine  Y
CakePHP 2.x  + http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/
Lithium Internal  N MySQL, SQLite3, CouchDB, MongoDB
Aura Wrappers around PDO  N MySQL, PostgreSQL, SQLite3, SQLServer
DooPHP Wrappers around PDO  N
Yii Internal  ?  Found a note from 2009 saying it worked
FuelPHP Internal  ?
Slim No DB support in framework

When I was researching frameworks 3 years ago I looked at Doctrine as a DBAL and even contributed a few patches to the project, but eventually got frustrated enough to bail on it and go with ZF’s vanilla approach. Should I try out Doctrine again or use something like Slim and keeping all my existing ZF1 database code?

Categories
howto

Installing PHP 5.4.0RC8 and Apache 2.4 on Ubuntu 11.10

php54Apache241About once every other week I try and spend some time at work thinking ahead. With PHP 5.4 on the horizon I began to wonder how our current Zend Framework application would fare if the SysAdmins decided to jump straight from PHP 5.2 to PHP 5.4. Would the site work at all? One way to find out. Lets install PHP 5.4RC8 and Apache 2.4.

I started by creating a fresh Ubuntu 11.10 VM. In complete disclosure, I removed some of the unneeded packages like LibreOffice first. I then cloned it so I would always have a base to work off of in the future.