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.

pranay aryal
6,140 Pointsnot 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

pranay aryal
6,140 PointsConnecting with PDO in the PHP & Databases with PDO

Ryan Duchene
Courses Plus Student 46,022 PointsSorry about the late reply. I tried it myself, and it seems to working great for me. Here are the steps I took:
- Create a new workspace using the PHP5 environment. (important)
- Create an
index.php
file and paste in the code at the bottom of this answer. - Create a file called
database.db
in the same folder asindex.php
. - 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
:
<?php
ini_set("display_errors", "On");
$db = new PDO("sqlite:./database.db");
var_dump($db);
exit;
?>

Kathryn Azar
2,292 PointsI 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
23,242 PointsIs 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
31,093 PointsRan into the same problem.

Ryan Duchene
Courses Plus Student 46,022 PointsI'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.

pranay aryal
6,140 PointsThanks for the reply. The instructions in the video tell you to open the workspace and use the .open command

Ryan Duchene
Courses Plus Student 46,022 PointsWhich video is this? I'll look into it.

Daniel Armatis
7,691 PointsI'm having the same problem...
Ryan Duchene
Courses Plus Student 46,022 PointsRyan Duchene
Courses Plus Student 46,022 PointsMy bad, I had forgotten about this course.
pranay aryal
6,140 Pointspranay aryal
6,140 PointsProblem not yet solved, please