garysd Posted March 21, 2015 Share Posted March 21, 2015 I'm using MAMP installed on Yosemite 10.10.2 installed at /Applications/MAMP. Everything worked perfectly when I had the files in the web root which is /Applications/MAMP/htdocs/. I then created a subdirectory named gtstore (/Applications/MAMP/htdocs/gtstore) and moved all the files into that directory. The code shown is copy & pasted from the files. I then made the edits shown in the Chapter 7, Server Setup "Using a Subdirectory" sidebar. This is the suggested change I made to .htaccess. The rest of the file was unchanged. <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine on # For the subdirectory of the store: RewriteBase /gtstore/ . . Next I made changes to the index.php file (/Applications/MAMP/htdocs/gtstore/index.php): // Require the configuration before any PHP code: require('./gtstore/includes/config.inc.php'); When I linked to the subdirectory from the web root I get a PHP error, and shown in the php_error.log: php_error.log: [20-Mar-2015 16:33:15 America/Los_Angeles] PHP Fatal error: require(): Failed opening required './gtstore/includes/config.inc.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.2/lib/php') in /Applications/MAMP/htdocs/gtstore/index.php on line 7 This is the where the error is occurring: 6. // Require the configuration before any PHP code: 7. require('./gtstore/includes/config.inc.php'); I tried the .htaccess in two locations; /Applications/MAMP/htdocs/.htaccess and /Applications/MAMP/htdocs/gtstore/.htaccess, but not in both locations at the same time. I've been working on this all day, checking and double-checking my work. Am I missing something simple here? Thank you for any help! BTW, great book! Link to comment Share on other sites More sharing options...
Larry Posted March 23, 2015 Share Posted March 23, 2015 Thanks for the nice words. The .htaccess and require are two separate issues. Your problem is with the require statement.. If a file is already in the gtstore folder and is including a file from within the includes directory--in that same folder, then you don't need to use "gtstore" in the require line. You should, most like, just be using require('./includes/config.inc.php') Link to comment Share on other sites More sharing options...
garysd Posted March 24, 2015 Author Share Posted March 24, 2015 Thanks, Larry! That was simple. It's working now, and I just have to adjust some of the links and the image links. Link to comment Share on other sites More sharing options...
Recommended Posts