-
How to use PHP for Include files
I want to use php for include files, but am having trouble getting it to work. I'm hoping it can be explained in simple steps. From what I can gather, the way to use PHP 5 on Bluehost for include files with .html extension, you need to:
1. have php.ini document in public_html
2. code apache handler application/x-httpd-php and put in extension .html
3. use extension .php on webpages (Can I just change a webpage extension from html to php, regardless of the coding within the page itself?)
4. use code <?php include "/includesfolder/includesfile.html" ?> in the webpage you want to call the include into
So, I have #1 done and that's fine. But, when I do #2, handler application/x-httpd-php and extension .html, the webpage won't display regardless of whether it has an html extension nor a php extension.
What am I missing?? Do I need some other type of file somewhere (htaccess?)?
Thanks in advance to anyone that can help me.
-
I would simply rename the file extension from .html to .php.
-
Thanks Justin, I did realize that after I posted and have decided to run my whole site with .php extensions.
However... eventhough I've put a php.ini file in my sub folder, and I've put an .htaccess (coded: AddHandler application/x-httpd-php5 .php
DirectoryIndex index.php index.html) and info.php in there as well (all with correct coding as far as I can tell), my index.php is still not displaying in web browser. When I check the info.php in a web-browser it says the Loaded Configuration File is the php.ini in the sub folder, which is correct... but index not loading on web.
Any ideas of what I am missing??
-
Have you tried to clear your browser's cache? Else, you may have to contact the Bluehost Support to check if you misconfigured something.
-
Hi Justin... thanks for following up,
My index.php is now displaying (It was code that satisfied .html but not .php). But now I seem unable to get my Includes to display.
I've put the code Options +Includes in the htaccess file, and ensured both allow_url_include = 1 and allow_url_fopen =1 are in my php.ini which is in my proper directory of mysite. I have an includes folder in directory of mysite and the include file I'm calling up has .php extension.
I've tried various versions of include code in my index page, but nothing works... (yes, I did clear my browsers cache, thanks)
Any ideas on what I am missing ?
Thanks again,
Cath
-
All fixed and displaying properly... great feeling! I had correctly put everything necessary in place for bluehost set up. The reason it wasn't working was due to a coding error.
Finding the Error Logs in cPanel helped me identify the problem and correct it. All good now.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules