marotta1 Posted June 28, 2008 Share Posted June 28, 2008 Hi all, I'm using the following in my .htaccess file to have extensionless page URL's. The web pages are PHP pages like example-video.php. <Files ~ ^(example-videos|example-videos2)$> ForceType x-mapp-php </Files> The problem I'm having is my PHP include files are not working. They are not displaying what they should output on the pages. They are simple include files with just an echo function to output some html. What would cause this to happen? Any help would be very much appreciated. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 28, 2008 Share Posted June 28, 2008 Please post code samples of the non working code between tags. Ken Quote Link to comment Share on other sites More sharing options...
marotta1 Posted June 28, 2008 Author Share Posted June 28, 2008 Here is an example of the include files. <?php echo " <ul> <li><a href=\"index.html\" class=\"menu\">Home</a></li> <li><a href=\"about.html\" class=\"menu\">About Us</a></li> <!-- li><a href=\"merchandise.html\" class=\"menu\">Merchandise</a></li --> <li><a href=\"gallery.html\" class=\"menu\">Gallery</a></li> <li><a href=\"wedding_packages.html\" class=\"menu\">Packages</a></li> <li><a href=\"events.html\" class=\"menu\">Events</a></li> <li><a href=\"legacy_team.html\" class=\"menu\">Legacy Team</a></li> <li><a href=\"links.html\" class=\"menu\">Links</a></li> <li><a href=\"contact.html\" class=\"menu\">Contact Us</a></li> <li><a href=\"example-videos\" class=\"menu\">More...</a></li> </ul>"; ?> <?php echo "<a href=\"javascript:window.location = 'http://www.socialmarker.com/?link='+encodeURIComponent (location.href)+'&title='+encodeURIComponent( document.title);\"><img class=\"displayed\" src= \"http://www.socialmarker.com/bookmark.gif\" border=\"0\" alt=\"Bookmark this Page\" /></a><noscript><a href=\"http://www.socialmarker.com\" >Social Bookmarking</a></noscript>"; ?> The include files are in a folder right under the root (domain name) and are very simple. Not sure why, but it seems to me the problem has to lie somewhere else. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 28, 2008 Share Posted June 28, 2008 I don't see any mention of the PHP include statement. Ken Quote Link to comment Share on other sites More sharing options...
marotta1 Posted June 28, 2008 Author Share Posted June 28, 2008 Sorry, thought you wanted to see the contents of the include files. This is where I am calling the first include. It's just used to output html in the domain for http://www.mydomainname.com/example-videos.php page. <div class="printhide"> <div class="menubackground"> <?php include('includes/menu.php'); ?> </div> <!-- /menubackground --> </div> <!-- /printhide --> Quote Link to comment Share on other sites More sharing options...
marotta1 Posted June 29, 2008 Author Share Posted June 29, 2008 Does anyone have any suggestions? I'm really stumped with this. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 29, 2008 Share Posted June 29, 2008 (I thought I replied to this, but I guess not.) Your code works for me (when I tried it a couple of days ago) except I had a problem browsing to the main file. I am guessing x-mapp-php is CGI specific and I had to use a server module value to get the main file to work. Your include() is using a file system path. Functionally, that has nothing to do with what your .htaccess file is doing as that only affects files that are requested from the web server using the http/https protocols. Either the path in the include() statement is not correct or the file name is not correct. 'includes/menu.php' looks for a folder called includes, starting in the folder where the script containing the include() statement is located and/or somewhere on the include_path setting. I recommend forming an absolute file system path using $_SERVER['DOCUMENT_ROOT'] so that include() statements can find the path/file no matter what the path is or where the file is that is including another file. If your includes folder is located in the document root, then - <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/menu.php'); ?> Quote Link to comment Share on other sites More sharing options...
marotta1 Posted July 5, 2008 Author Share Posted July 5, 2008 I've tried that as well according to you suggestion PFMaBiSmAd as well as a lot of other things, but it's still not working. Can you ro anyone offer any more input. I've tried this so many different ways. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 5, 2008 Share Posted July 5, 2008 it's still not working.Well what exactly is it doing or not doing? What file name are you browsing to? What is your current code? Tell us what you see in front of you and what is in your browser when you do a "view source". We only see the information you provide in your posts and based on what little specific information you have provided so far (and that the code worked for me), my guess is that php is not being parsed on your server. The .htaccess information you posted (assuming that x-mapp-php has meaning on a GCI/php system - it caused a file download prompt on a server module/php system) causes the extension-less files example-videos. or example-videos2. to be treated as php files on the server. It does nothing to files named example-videos.php or example-videos2.php. Quote Link to comment Share on other sites More sharing options...
marotta1 Posted July 8, 2008 Author Share Posted July 8, 2008 Sorry for being so vague last time. It's been tough to get to this due to business. I am using an include which is what shows up in the view source. <?php include('includes/menu.php'); ?> I've tried the server root way as well. <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/menu.php'); ?> I've also tried it with the server path: <?php include('/kunden/homepages/47/d24232649/htdocs/Wedding Video/includes/menu.php'); ?> The webpage is www.domainname.com/example-videos . It is saved without the .php extension and included in the Forcetype statement in .htaccess. I did find out PHP is run as CGI on this server and the Apache version is 1.3.34. The same include file works fine on the other pages with .php extensions or with .html extensions using AddType x-mapp-php4. Quote Link to comment Share on other sites More sharing options...
vicodin Posted July 8, 2008 Share Posted July 8, 2008 If its showing up in the source then the server is not parsing it or there is an echo with ' ' brackets which takes what ever is in those brackets and prints it whether there is php code in it or not. If thats the case then change them to "". If theres nothing like that then your server is not running php. Is that in a html file? if so then you need to put in the htaccess for the server to use php in html files. Example: AddType application/x-httpd-php .html Quote Link to comment Share on other sites More sharing options...
vicodin Posted July 8, 2008 Share Posted July 8, 2008 Also if its a htm file then you would need: AddType application/x-httpd-php .htm Quote Link to comment Share on other sites More sharing options...
marotta1 Posted July 8, 2008 Author Share Posted July 8, 2008 The echo already has " " double quotes. It is not in an html file. Some of the other pages of the site are .html pages. The include file is inside of a webpage saved without an extension. It was previously saved with a .php extension but no longer is. That is why I'm using Forcetype; to get the URL to work without .php at the end. If there was a way to use: AddType application/x-mapp-php NoExtensionHere it'd probably work great, lol. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.