Closed Thread
Results 1 to 8 of 8

Thread: help installing a php script

  1. #1
    pietimer is offline x10Hosting Member pietimer is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    31

    help installing a php script

    I'm trying to install this php script and I'm getting hung up.

    I've gotten to the fifth part in the instructions where it says

    5. Configure db.php

    Change to the phpgiftreg/ directory and edit the db.php file. There's a line
    with a call to mysql_connect(). Change it to suit your setup.

    mysql_connect("host","username","password")
    or die("Could not connect: " . mysql_error());
    I edited my db.php file to say

    mysql_connect("pietimer.exofire.net","admin","admi n")
    or die("Could not connect: " . mysql_error());

    but I get this error when I try to access pietimer.exofire.net/giftreg/index.php

    Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/pietimer/public_html/giftreg/db.php on line 16
    Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 111
    Anyone know what's going on?

    Thanks!

  2. #2
    DeadBattery's Avatar
    DeadBattery is offline Community Support Team DeadBattery is a name known to allDeadBattery is a name known to all
    Join Date
    Mar 2008
    Location
    localhost
    Posts
    4,019

    Re: help installing a php script

    You need to use localhost and use your cPanel username and password.
    mysql_connect("localhost","pietimer","password")
    or die("Could not connect: " . mysql_error());
    Make sure your database is like pietimer_databasename also.


  3. #3
    pietimer is offline x10Hosting Member pietimer is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    31

    Re: help installing a php script

    Hey! Thanks! That was exactly what I needed.

    Now I have another problem, want to solve it for me?

    When I try to enter a username/password it says:

    Could not query: No database selected
    I named my database: pietimer_phpgiftreg like you said. Could it have something to do with the last instruction?

    7. Create Apache alias

    Edit your httpd.conf and add an Alias like so:

    Alias /phpgiftreg/ "/path/to/phpgiftreg/"

    The trailing slashes are important. Restart the web server and you should
    be good to go.
    I don't really know whats going on...

    Thanks! You're my best friend.

  4. #4
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: help installing a php script

    Did you go to phpmysql option in you CPanel and then created the database with the correct name?

    Did you creat a mysql user and gave him the previlages ?

    You have to do that before attempting to open the database via your php code and query for some data.
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

  5. #5
    pietimer is offline x10Hosting Member pietimer is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    31

    Re: help installing a php script

    Thanks for the suggestion but it's a yes on both accounts. I created the database in phpmysql with the name pietimer_giftreg and I created a mysql user with all privileges, attached it to that database, and used that username/password in my db.php file.

    Any ideas?

    Thanks.

  6. #6
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: help installing a php script

    step 7 should not play any part in the mysql error. Step 7 only changes www.blah.com/path/to/phpgiftreg to www.blah.com/phpgiftreg (basically creating an symbolic link (those who are familiar with *nix based systems know what this is) to the directory /path/to/phpgiftreg.

    onto your mysql problem. you do not put in your cpanel username/password to gain access to the mysql db. You have to create a username/password and a database from the mysql setup in cpanel and add the user you created to the database you want to use. then in the db.php file, look for mysql_connect (which you already have, and put the newly created username/password with the host being localhost and then look for mysql_select_db, and put the newly created database in there.

    PHP Code:
    mysql_connect("localhost""user""pass");

    mysql_select_db("database"); 
    Remember, your username and database are prefixed with your cpanel username. Example: pietimer_username, pietimer_database; that's if your cpanel username is pietimer ;)

    -xP
    Last edited by xPlozion; 08-29-2008 at 08:31 PM.

  7. #7
    pietimer is offline x10Hosting Member pietimer is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    31

    Re: help installing a php script

    Whoops, didn't change the database name! Thanks for the pointers and help everybody!

  8. #8
    Nathan H is offline x10 Elder Nathan H is an unknown quantity at this point
    Join Date
    Apr 2006
    Posts
    562

    Re: help installing a php script

    *thread closed*
    If you need any more help with this issue feel free to re-open this thread or create another one
    Nathan H Formerly UnFoundBug



    http://www.theadmin.co.uk - Yes i know the colours don't go, I'm working on it.

    VPS Admin | x10-commandments

    So thats where it went! I thought i was losing my mind.

Closed Thread

Similar Threads

  1. PHP Photo browser and x-fading slideshow script...
    By unmanaged in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 02-21-2008, 05:46 PM
  2. RSS to HTML PHP Script (FREE)
    By unmanaged in forum Scripts & 3rd Party Apps
    Replies: 6
    Last Post: 02-21-2008, 04:44 PM
  3. How to protect images without htaccess using PHP
    By frznmnky in forum Tutorials
    Replies: 0
    Last Post: 12-26-2007, 11:51 AM
  4. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers