jayLim Posted March 9, 2014 Share Posted March 9, 2014 Hello! I can't understand why I get this when testing out the registration form in Chapter 18: An error ocurred in script '/path/to/html/register.php' on line 9: require(/path /to/mysqli_connect.php): failed to open stream: No such file or directoryDate/Time: 3-9-2014 18:32:41Array( [_GET] => Array ( ) [_POST] => Array ( [first_name] => [last_name] => [email] => [password1] => [password2] => [submit] => Register ) [_COOKIE] => Array ( [SQLiteManager_currentLangue] => 2 [PHPSESSID] => efb1be7b8cd02e45109c9bac0e78854a ) [_FILES] => Array ( ) [_SERVER] => Array ( [HTTP_HOST] => localhost:8888 [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_REFERER] => http://localhost:8888/html/register.php [HTTP_COOKIE] => SQLiteManager_currentLangue=2; PHPSESSID=efb1be7b8cd02e45109c9bac0e78854a [HTTP_CONNECTION] => keep-alive [CONTENT_TYPE] => application/x-www-form-urlencoded [CONTENT_LENGTH] => 67 [PATH] => /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2 PHP/5.5.3 [SERVER_NAME] => localhost [SERVER_ADDR] => ::1 [SERVER_PORT] => 8888 [REMOTE_ADDR] => ::1 [DOCUMENT_ROOT] => /Users/jlim/Website/phpmysql4_scripts/ch18_exercise [SERVER_ADMIN] => you@example.com [SCRIPT_FILENAME] => /Users/jlim/Website/phpmysql4_scripts/ch18_exercise/html/register.php [REMOTE_PORT] => 51723 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => POST [QUERY_STRING] => [REQUEST_URI] => /html/register.php [SCRIPT_NAME] => /html/register.php [PHP_SELF] => /html/register.php [REQUEST_TIME_FLOAT] => 1394404361.57 [REQUEST_TIME] => 1394404361 [argv] => Array ( ) [argc] => 0 ) [page_title] => Register [_SESSION] => Array ( )) Fatal error: require(): Failed opening required '/path/jlim/to/mysqli_connect.php' (include_path='.:/Applications/MAMP/bin/php/php5.5.3/lib/php') in /path/to/html/register.php on line 9 Thanks Link to comment Share on other sites More sharing options...
Larry Posted March 10, 2014 Share Posted March 10, 2014 You can't use 'path/to' in your code unless you actually have "path" and "to" folders on your system, which is unlikely. As I write i the book, you'll want to change "path/to" to the actual path to that file. Link to comment Share on other sites More sharing options...
jayLim Posted March 11, 2014 Author Share Posted March 11, 2014 Yes of course, I rewrote the original location of the files just to abbreviate the error message. This is what I really get: An error ocurred in script '/Users/jlim/Website/phpmysql4_scripts/ch18_exercise/html/register.php' on line 9: require(/Users/jlim/Website/phpmysql4_scripts/mysqli_connect.php): failed to open stream: No such file or directoryDate/Time: 3-10-2014 22:05:33 Array( [_GET] => Array ( ) [_POST] => Array ( [first_name] => [last_name] => [email] => [password1] => [password2] => [submit] => Register ) ... Fatal error: require(): Failed opening required '/Users/jlim/Website/phpmysql4_scripts/mysqli_connect.php' (include_path='.:/Applications/MAMP/bin/php/php5.5.3/lib/php') in /Users/jlim/Website/phpmysql4_scripts/ch18_exercise/html/register.php on line 9 It's really strange, shouldn't be happening?! J. Link to comment Share on other sites More sharing options...
jayLim Posted March 11, 2014 Author Share Posted March 11, 2014 Well, I think I kind of found the solution, in the database connection instead of require(MYSQL); I wrote require('../mysqli_connect.php'); Any comments? I mean the first method should work anyways. J. Link to comment Share on other sites More sharing options...
Larry Posted March 12, 2014 Share Posted March 12, 2014 Either approach will work if you're using the right value. It sounds like the absolute path would be /Users/jlim/Website/phpmysql4_scripts/ch18_exercise/mysqli_connect.php. Link to comment Share on other sites More sharing options...
jayLim Posted March 16, 2014 Author Share Posted March 16, 2014 Ok, I didn't type the right path, it's working now, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts