Wednesday, January 08, 2014

PDO SQlite error: unable to open database file

When you're testing your PHP applications with SQLite you might bump into a problem when using PDOthat states "SQLSTATE[HY000]: General error: 14 unable to open database file".
When using Zend Framework 2, you might only get the InvalidQueryException "Statement could not be executed", for which I've made a pull request on Github to make it more clear what's going on.
The problem is about permissions. For SQLite it's not enough to make the database file writeable for the web server user, but also the directory this file is in.
I found the solution on StackOverflow, thanks to Austin Hyde for giving the answer that pointed me in the final path to the solution.
In order to fix this issue I changed the group of the directory and db file to "www-data", the group my web server (Apache) was running on, and made them writeable for the group.
$ cd /path/to/application
$ chgrp www-data data/db
$ chgrp www-data data/db/application-test.db
$ chmod g+w data/db
$ chmod g+w data/db/application-test.db
Hope to help other developers using SQLite in their development save a lot of time searching for something this trivial.

Wednesday, January 01, 2014

Have a wonderful 2014!


Welcome 2014! A new year means again a new opportunity to stand out and make a difference. Each year people make a bunch of new year's resolutions that are hard to maintain. I want to ask my readers to do something for the community: update documentation, fix bugs on your favourite project or attend a PHP user group event or conference.

If you need some inspiration, these are upcoming PHP conferences you don't want to miss:

SkiPHP Conference 2014: January 17 - 18 Salt Lake Utah

PHPBenelux Conference 2014: January 24 - 25 in Antwerp Belgium
SunshinePHP Conference 2014: February 6 - 8 Miami Florida

Confoo Conference 2014: February 24 - 28 Montreal Canada

TEK PHP Conference 2014: May 19 - 23 Chicago Illenois
More conferences will be announced, but this will get you started.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.