SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: php and mysql

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    38
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    php and mysql

    Hi,

    I have been using php and mysql for several years and recently my XP installation died and I couldn't revive it. So I have a new installation of Windows 7 Ultimate.

    I have installed PHP 5.3 and IIS following instructions from this forum. That works. I have also installed MySQL 5.6 and that works.
    However, PHP and MySQL don't work together. I have been through the configurations time and time again but I just cannot see where the problem lies.

    It manifests itself from the browser not recognising the CSS scripts.

    calling localhost/phpinfo.php gives

    PHP Warning: phpinfo() [<a href='function.phpinfo'>function.phpinfo</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST' instead in C:\inetpub\wwwroot\phpinfo.php on line 3

    calling localhost/index.php gives

    Pre-connect

    This comes from my connect script:

    PHP Code:
    ini_set('display_errors',1);
    error_reporting(E_ALL);

    echo 
    '<p style="color: black;">Pre-connect</p>';

    $dbcnx = @mysql_connect('localhost''root','mancity1' );

    if (!
    $dbcnx) {

        exit( 
    '<p>Unable to connect to server</p>');

    }

    echo 
    '<p style="color: black;">Connected Server</p>';



    if(!@
    mysql_select_db('ut_db')) {

        exit(
    '<p>Unable to locate utilities database.</p>'); 

    }

    echo 
    '<p style="color: black;">Connected Database</p>'
    So I know it is calling the script. The display statements are in there temporarily while I sort out this problem.
    It does not matter whether I replace the mysql_connect function with anything else, it displays the same characteristics and it won't go any further. I know this is going to be something obvious but please help.

    Thanks,

    Steve
    Last edited by cpradio; Feb 19, 2013 at 14:25. Reason: Added [php] tags

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You need to set your timezone in the php.ini file
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    38
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you,

    I've set timezone to:

    date.timezone = "Europe/London"

    That has solved one problem but the other problem still exists.

    Steve

  4. #4
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,000
    Mentioned
    101 Post(s)
    Tagged
    0 Thread(s)
    You might not have the mysql_* extension installed. In any case you should be migrating over to either the mysqli_* extension or PDO as the mysql_* is deprecated as of the current php version and will very likely be removed in the next php version.

    Also remove the @ as they are surpressing any errors
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  5. #5
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,807
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Hi @steveob200653 ;

    Take a look at how PHP Manual recommends the use of mysql_connect();

    http://php.net/manual/en/function.mysql-connect.php

    When the connection fails mysql_error() shows why you cannot connect.
    Last edited by John_Betong; Feb 20, 2013 at 05:01. Reason: speling: not my fortay

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    38
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you,

    I have now set the extension in php.ini and it is now working. I will migrate the whole caboodle to use either mysqli_or PDO when I've either found or written a program to replace strings. Brilliant, a language that changes the syntax and isn't backwards compatible. I'm very impressed!

    Steve


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
  •