Results 1 to 11 of 11

 

Thread: How to make local php file working on remote server?

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts


    hello, I have created a Search Form and a Result page - both php - using Dreamweaver. They are connected to my localhost MySQL database and work fine. Problem is while I could easily export the table from my local MySQL databse into my remote MySQL database, how should I change my php files to let them work on remote server as well?

    Anyone could help me please?? Thanks a lot and I would really appreciate all help!!
    Cheers
    YJ

  2. #2
    Brett's Avatar
    Registered User

    Status
    Offline
    Join Date
    Dec 2003
    Location
    Oxford
    Posts
    521
    Thanks
    2
    Thanked 11 Times in 8 Posts
    Hi,

    Are you saying that you want to leave the DB on your local machine and connect to it from your remote web server?

    If so it is just a matter of changing the database connection details to point at your local machine but I would have thought you need IIS running (i.e. turn your PC into a webserver)

    I apologise if I've got the wrong end of the stick though.

    Brett

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers Brett - but what I really want is to modify the php file (says "search.php and result.php") to let them work with my database on my remote server. I have no problem export the database from my localhost, but how to reconfigure my php file so that it would get data from the remote server's db instead of the one from localhost?

    It works fine when everything is local by the way.

    Thanks a lot
    Cheers
    YJ

  4. #4
    mxp
    Registered User

    Status
    Offline
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You will probably need to change the details that php uses to connect to the db_server.

    ie

    mysql_connect('db_server', 'db_username', 'db_password');


    you may need to check how your particular server is set up. Sometimes you need to specify exact location of 'db_server' and sometimes you can just use 'localhost'.

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    still doesn't have a clue - sorry for being so dumb -

    My local files were created using Dreamweaver, and I just used the database application to connect to my database, i.e. didn't write the php scripts myself. However when this goes remote, I can never connect to my remote db - whilst using the exactly same connection details I could connect to my db using MySQL Administrator.

    So..... What is the matter?????

    Thanks a lot mxp and cheers mate.
    Cheers
    YJ

  6. #6
    mxp
    Registered User

    Status
    Offline
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what error message are you getting?

  7. #7
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Got the error message like dreamweaver cannot determine server time and synchronize will not be available.... but has been resolved by enabling passive ftp.

    However... though I can connect directly to my server_db from Dreamweaver, the result.php still not showing? I had set everything point to my server_db in this case to be sure, and I got an error message as:

    Warning: main(Connections/server_db.php): failed to open stream: No such file or directory in /home/mysite/public_html/result.php on line 1

    Fatal error: main(): Failed opening required 'Connections/server_db.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mysite/public_html/result.php on line 1

    What is that mean? Big thanks mxp
    Cheers
    YJ

  8. #8
    mxp
    Registered User

    Status
    Offline
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think those error messages mean that php is trying to look for the page server_db.php and can't find it because either the path is wrong or maybe that no such file exists. are you able to tell if the file server_db.php is on your server? (probably in folder connections)

    is it possible for you to post some code?

  9. #9
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah the
    Cheers
    YJ

  10. #10
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry accidently clicked on submit whilst I not even finish typing.

    the "server_db" indeed is just the name of the connection I gave whil creating the connection between Dreamweaver & my server database (surely together with all connection information such as username, databasename, password, and host name). The connection seem fine (from test) and that the recordset test seem fine as well.

    Problem only occurs when everything goes live on server. Search.php works but the result.php page it points to gave the error message as shown before.

    Thanks again mxp. BIG Cheers.
    Cheers
    YJ

  11. #11
    mxp
    Registered User

    Status
    Offline
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, could you clairfy what you mean by "The connection seem fine (from test)".

    Have you checked that there is a folder on your remote server call connnections(in the same folder as results.php)? and is there a file called server_db.php in the connections folder?

    given that it all works on your local server, but not on your remote, it looks to me that you havent set up all the files on your remote server.



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2