PHP & MySQL Novice to Ninja Chapter 2 include failed to open because the directory does not exist

I have been working my way through PHP & My SQL: Novice to Ninja 6th edition. I have had a few hiccups but have managed to work things out until the end of chapter 2 Many Templates, One Controller. When I set up the files as directed and go to instead of a form asking me for my name I receive these messages:
Warning : include(/home/vagrant/Code/Project/public/…/templates/form.html.php): failed to open stream: No such file or directory in /home/vagrant/Code/Project/public/index.php on line 3

Warning : include(): Failed opening ‘/home/vagrant/Code/Project/public/…/templates/form.html.php’ for inclusion (include_path=’.:/usr/share/php’) in /home/vagrant/Code/Project/public/index.php on line 3
What do I do to fix this?
Help is greatly appreciated.

Is the full path being output in the error message (this forum software is condensing the middle of the value) where the file is actually at, with all the exact same spelling, punctuation, and capitalization?

This is exactly the error message except that in the error message there are only 2 .'s between public/ and /templates

.. in a path means “go up one directory”
is the same as saying

Does that second path exist?

no, it doesn’t. At least I don’t think it does. If I am running vagrant and type cd /home I get an error that it does not exist. I have never worked with VM’s before. That was one problem I encountered when installed homestead through gitbash, but the other examples that I did worked fine so I didn’t keep trying to pursue that issue.

If you’re logged in as the vagrant user, cd ~ should take you to /home/vagrant. (cd ~ just means “take me to my home directory”.)

I’m fairly sure that /home/vagrant exists, because your index.php page is located in

Try this: Go to the directory with index.php in it. Go up one directory (cd .., which should put you in the Project directory), and then see if there’s a templates directory where you are. If so, cd to it, and see if there is a form.html.php in that templates directory.

My index.php file is on my computer not in vagrant. When I did these commands:

git clone my_project
cd my_project; mkdir -p Project/public

should the “my_project” have been within vagrant?

PHP seems to disagree:

Wherever your index.php that PHP is running is, go up one directory and look for a templates directory. If one does not exist, you’ve not copied something you were supposed to copy. If it does, and inside that folder form.html.php does not exist, you’ve not copied something you were supposed to copy.

Those files are as they should be, but this is the path to the index.php file:
the templates folder is in the Project folder and within the templates folder is the file form.html.php

Are you SURE thats the file that PHP is reading?

Add this line to index.php at the very top:
<?php echo "Hello Diane, I am in this directory." ?>
Save, and reload the page.

The result was Hello Diane, I am in this directory.
and then the warnings

This is how I am calling that –

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.