Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


not able to use command .open in treehouse console

Not able to use .open command in PHP and Databases with PDO workspace the error message is "unknown command or invalid arguments"

6 Answers

My bad, I had forgotten about this course.

Problem not yet solved, please

Sorry about the late reply. I tried it myself, and it seems to working great for me. Here are the steps I took:

  1. Create a new workspace using the PHP5 environment. (important)
  2. Create an index.php file and paste in the code at the bottom of this answer.
  3. Create a file called database.db in the same folder as index.php.
  4. Either run php index.php in your console or click the eye icon in the upper-right corner of your workspace.

Hope that helps!

The code for index.php:


ini_set("display_errors", "On");

$db = new PDO("sqlite:./database.db");



I am having the same problem. I contacted the team at treehouse and it seems they expect the forum to solve a problem that is very likely on their side. I would like to be able to follow this tracks as intended :(

Scott Montgomery
Scott Montgomery
23,242 Points

Is there a solution for this yet?
Using .open in the sqlite3 console still gives the following error: Error: unknown command or invalid arguments: "open". Enter " .help" for help

It is from this video: https://teamtreehouse.com/library/php-databases-with-pdo/getting-started-with-pdo/introductions

Robbie Thomas
Robbie Thomas
31,093 Points

Ran into the same problem.

I'm fairly confident that Treehouse has not included databases (and necessary extensions like PDO) with Workspaces, simply because of the amount of effort it would take.

Thanks for the reply. The instructions in the video tell you to open the workspace and use the .open command

Which video is this? I'll look into it.

Daniel Armatis
Daniel Armatis
7,691 Points

I'm having the same problem...