SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    May 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't get Wamp to use PHP include - Really need some help please.

    Hi guys,

    I have a fresh install of the most up to date version and am trying to get PHP includes working. I have had it working on previous versions but don't remember what I did.

    I have tried all the suggestions found online but still have no luck.

    This seems to be the most popular solution, however, this still doesn't work.

    Then add the following code:
    AddType text/html .shtml
    Options +Includes
    AddOutputFilter INCLUDES .shtml
    The above code should be above "<Directory />" in httpd.conf file
    Then find "Options Indexes FollowSymLinks" and replace it with:
    Options +Indexes +FollowSymLinks +Includes
    Restart wamp and enjoy.

    Could someone please tell me how to get this working as I reall need it quick.

    I have one more problem, when I click on the Wamp icon, my projects and select my project it says it can't find it. If I manually navigate to localhost/redesign/ then the site will appear. Any ideas??

    Version of Operating system? - Windows 7 64bit
    Version of Wamp Server installed? - 2.5
    Version of Apache you are running? - Apache : 2.4.9
    Version of MySQL you are running? - MySQL : 5.6.17
    Version of PHP you are running? - PHP : 5.5.12
    PHPMyAdmin : 4.1.14
    SqlBuddy : 1.3.3
    XDebug : 2.2.5

    I have tried this and still nothing:

    Inserted Include after this line - Options Indexes FollowSymLinks

    Uncommented these two lines:

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

    I have made sure that include_module is selected.

    I am using this line in my html file:

    <?php include 'form.php' ?>

    Still not working.

    What the hell am I doing wrong?

    Blinky

  2. #2
    SitePoint Member
    Join Date
    May 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Turns out I have to have the file containing the html named with a php extension. Not sure why as I have done this before and left the extension as html.

    Nevermind it is working now.

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,130
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Just a bit of background, it is considered a bad practice to use html as an extension for PHP to begin with. As any html files that don't need to parse PHP, must run through the PHP parser anyway, thus slowing their load times.

  4. #4
    SitePoint Member
    Join Date
    May 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers for the info, is it then better for me to convert all my HTML files to PHP extensions?

    Most of my HTML files do not have any PHP in them, however, I do not know whether it is good practice or not to have all the filetypes the same or not.

    Cheers again,

    Blinky.

  5. #5
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,130
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Blinkydamo View Post
    Cheers for the info, is it then better for me to convert all my HTML files to PHP extensions?

    Most of my HTML files do not have any PHP in them, however, I do not know whether it is good practice or not to have all the filetypes the same or not.

    Cheers again,

    Blinky.
    No for the same reason. If you take a pure HTML file and give it a PHP extension, you are effectively doing the same thing as allowing HTML files execute PHP commands. You are forcing pure HTML files to go through the PHP parser and thus take a bit longer (negligible in most cases, but it still is slower) to load.

    So yes, keep pure HTML with the html extension and give those that have PHP in them with the php extension.

  6. #6
    SitePoint Member
    Join Date
    May 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much for the info, learnt two new things today

    Right off to get things running.

    Cheers

    Blinky


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •