Includes not working locally
Posted by: david_mankellow (---.zone2.bethere.co.uk)
Date: December 22, 2009 12:10PM

Hi,

I'm pretty new to PHP and I thought i'd start using it to clean up my code. I thought a good place to start would be using includes. I have includes set up but they don't work locally on my WAMP server but they work in my live server. I have googled the problem and found no solution as yet. Any ideas?

Thanks,
Dave

Options: ReplyQuote
Re: Includes not working locally
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: December 22, 2009 03:45PM

how are you using include? You dont need to do anything for includes to work.

Options: ReplyQuote
Re: Includes not working locally
Posted by: david_mankellow (---.zone2.bethere.co.uk)
Date: December 22, 2009 04:11PM

The normal way I assume. I'm calling <?php include("../php/includes/includes.php"winking smiley; ?> in the page for the navigation of the page. The code for the nav is in the includes.php file. The file must be in the correct directory or it wouldn't work in live.

The page that works in LIVE is [davidmankellow.com]. Locally the navigation at the top simply isn't there. There are no errors in the log either. Should I change the include_path in both the php.ini files?

I've also tried different versions of PHP. Initially I had an older version locally to the one that my web server uses. Then I tried the same one that my web server uses and it didn't work, then I've downloaded the latest version and still the same outcome. I'm probably missing something obvious!

Options: ReplyQuote
Re: Includes not working locally
Posted by: david_mankellow (---.redstone-isp.net)
Date: December 23, 2009 01:00PM

Anyone have any ideas where i'm going wrong?

Options: ReplyQuote
Re: Includes not working locally
Posted by: yfastud (Moderator)
Date: December 23, 2009 05:08PM

if you include in html file, you need to enable it first, so make sure you have this line in main config file or htaccess file in that particular folder

#parsing PHP in html files on Win
#
AddType application/x-httpd-php .html

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Includes not working locally
Posted by: david_mankellow (---.redstone-isp.net)
Date: December 23, 2009 05:13PM

In the folder of the includes?

Cool, i'll try that and see how I fare!

Options: ReplyQuote
Re: Includes not working locally
Posted by: yfastud (Moderator)
Date: December 23, 2009 05:17PM

no, I meant the root folder of the project you will use include, or in www folder if you want all projects use include

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Includes not working locally
Posted by: david_mankellow (---.redstone-isp.net)
Date: December 23, 2009 05:19PM

Cool, thanks!

Options: ReplyQuote
Re: Includes not working locally
Posted by: david_mankellow (---.redstone-isp.net)
Date: December 23, 2009 05:20PM

DO I need to do anything with the include_path in the php.ini file(s)?

Options: ReplyQuote
Re: Includes not working locally
Posted by: yfastud (Moderator)
Date: December 23, 2009 05:31PM

in apache make sure already enable "include_module"
in php, make sure to enable "allow url fopen" and "allow url include" if needed

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Includes not working locally
Posted by: stevehw (---.17-1.cable.virginm.net)
Date: October 13, 2014 04:37PM

i HAVE DONE ALL OF THE ABOVE AND STILL NOT INCLUDING PHP FILES....LIKE

INCLUDE"FILE_X.PHP";

Options: ReplyQuote
Re: Includes not working locally
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: October 13, 2014 04:56PM

Please show the actual code. Also where it is actually stored.

Also check that the file is actually called file_x.php and not file_x.php.txt

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.8 32bit & 64bit) Aestan Tray Menu 3.2.4.7
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.