SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Connecting to MySQL in PHP

    Hi guys how r u doing?

    Port 80 is used by IIS.
    Thus when i run php i use port 81
    then it is: localhost:81/

    It works fine.
    But i want to connect to MySQL:

    I get the following error:





    Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in C:\wamp\www\LesWebDevelopment\ic1s.php on line 17

    Warning: mysql_connect() [function.mysql-connect]: Error while reading greeting packet. PID=3796 in C:\wamp\www\LesWebDevelopment\ic1s.php on line 17

    Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in C:\wamp\www\LesWebDevelopment\ic1s.php on line 17

    Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\LesWebDevelopment\ic1s.php on line 17






    I changed the port to 81 my.ini

    But i still get error timelimit 60 seconds exceeded

    this is the code:


    Code:
    PHP Code:
    <?php

    $dbhost 
    'localhost:81';
    $dbuser 'root';
    $dbpass '';

    $conn mysql_connect($dbhost$dbuser$dbpass) or die ('Error connecting to mysql');

    $dbname 'ic1s';
    mysql_select_db($dbname);

    ?>

    Thanks in advance

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Have you read the following article from the MySQL documentation?

    B.5.2.9. MySQL server has gone away

    That will give you plenty of possibilities and debugging ideas to get started. Unfortunately, without access to the MySQL and Apache servers themselves, there isn't much we can do to help without more information.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks ..

    But apache is working on port 81 ..

    the only thing is now with MySQL

  4. #4
    SitePoint Member
    Join Date
    Mar 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I really depends on how MySQL is configured but I believe the default port is 3306. In any case it will be different from what Apache uses

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot ..
    thats what i needed to know ..


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
  •