SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Configuration problems???

    Hi all,

    Having recently bought 'Build Your Own Database Driven Web Site Using PHP & MySQL'. I went through the installation process and everything was absolutely fine. Unfortunately I had to do a restore and went through the installation again. I am having hair pulling out inducing problems now.

    I have a simple count example that utilises an include, so there is a folder with index.php in it which has an include statement that displays the output in a count.html.php php file. This works fine.

    I then have this example which is constantly producing the following:

    Server error
    The website encountered an error while retrieving http://localhost/output/. It may be down for maintenance or configured incorrectly.
    Here are some suggestions:
    Reload this webpage later.
    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.


    The codes is as follows and password is replaced with my root password:

    index.php

    PHP Code:
    <?php
    $link 
    mysqli_connect('localhost''root''password');
    if (!
    $link)
    {
    $output 'Unable to connect to the database server.';
    include 
    'output.html.php';
    exit();
    }
    ?>
    output.html.php

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <p>
    <?php echo $output; ?>
    </p>
    </body>
    </html>
    Hopefully someone can help me out, it would be greatly appreciated.

    Thanks

  2. #2
    SitePoint Member
    Join Date
    May 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so I have turned 'display_errors = Off' to 'display_errors = On' and am now getting the more helpful error message:

    'Fatal error: Call to undefined function mysqli_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ouput\index.php on line 2'

    Now the first time I set this up as I said I had no problems. I've made sure I've uncommented the following line:

    extension=php_mysqli.dll

    Any ideas???

    In the book it says to download the VC6 Thread Safe version of PHP 5.3 for Windows. However I have read you can only now download PHP 5.2 now. The book also says to make a copy of php.ini-development and rename it php.ini.

    I don't see this file but I do see a file called php.ini-recommended which I have assumed is the file I should be changing and actually have changed.

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    php_mysqli.dll

    Make sure that file is in with your extensions.

    Whenever you alter php.ini restart Apache.

    Check your HDD, you old php.ini may be knocking about, and I can tell you, it will send you mad - if you are not sure which ini file is affecting your site.

    It happened to me but I'm ok now, mwaaahhhaaahhhaaaa!

  4. #4
    SitePoint Member
    Join Date
    May 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Cups for the heads up.

    The last post by Northrut's at the below link did the trick in the end.

    http://www.sitepoint.com/forums/php-...ge-762814.html

    Installation was so easy the first time and this problem has literally driven me crazy.

    However I guess you learn more from your mistakes and the installation process is now concrete in my mind!

    Here's to getting on with the rest of the book, good times!!!

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    However I guess you learn more from your mistakes and the installation process is now concrete in my mind!
    Exactly. That and a myriad other tiny snippets of information will have entered your brain, then in the future when faced with an obscure error, or some failed programming attempt you will go "Oh, hang on I know where that setting is - I think..." - plus you now have a better understanding of how the 'stack' (LAMP, WAMP) hangs together, and role each part plays.


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
  •