Posts Tagged: php

MongoDB looks Interesting

I might take a look at installing MongoDB on my server.  I like the idea of a document-driven, NoSQL database, especially after working with relational SQL databases for years, and MongoDB looks interesting.  You can read more about it in Developing scalable PHP Applications using Mongo DB. What caught my interest is how flexible using it appears to be from the linked article.  Plus, using something other than a SQL database could be a nice change of pace.  I HATE adding fields to a SQL database table, and it looks nearly painless in these examples.

Another thing that seemed as though it were worth looking into is it’s apparently designed with storing whole files in mind.  I’ve stored files in MySQL databases before, but MySQL really isn’t designed with that in mind, but at the same time, if I’m going to be making a lot of small binary files, I don’t like them cluttering up my directories.

PHP: Random Password Oneliner

I am exceedingly lazy, so I made a one-liner random password generator.

How it works: Creates an md5 from a random string, packs this into binary representation, base64 encodes that, strips some of the characters used by base64 (most importantly the = that are typically at the end), and then limits it to 8 characters. It’s been broken out here on several lines to make modifying it a bit easier.

(Could make longer passwords by changing what’s allowed and providing more text to base64_encode or hexadecimal to pack.)

$randpw = substr(
   preg_replace('/[^a-zA-Z0-9\.\-!\$]/', '',
      base64_encode(
         pack('H*', md5(time().rand()))
      )
   ), 0, 8);

Update on phpBB3.0.4 on PHP 5.3.0RC2

Hmm… well it’s not crashing outright according to GDB, so I can only imagine it’s encountering a fatal error along the installation process.

Update: It’s dying on the line that reads $install->load(); However, it doesn’t toss an error when it does so. Interesting. It does not crash there, however, if I modify it to be passed two empty strings as parameters.

phpBB 3.0.4 on PHP 5.3.0RC2

I went ahead and decided to try installing phpBB 3 on PHP 5.3.0RC2 running CGI. The initial build of PHP 5.3.0RC2 went incredibly smoothly, and only a handful of tests failed when I ran `make test.` Got it installed in my web server’s chroot environment and phpinfo runs fine. (After accidentally configuring CGI to use the CLI binary, hehe.)

After that phpBB3 however it gives me the white screen of death when I try progressing into installation. No matter what I do, I can’t seem to get an error message out of it. I’ll try to get some discernibly useful information from it in the coming days.  I suspect it’s crashing but the chroot doesn’t have direct access to debug tools, so I may need to set it up elsewhere first.