Skip navigation
ssj111mike
Currently Being Moderated

PHP pages not displaying on Remote/Web server

Jul 19, 2012 8:01 AM

Tags: #problem #cs5 #error #php #server #dreamweaver #database #mysql #remote #recordset #rec

All,

 

Be gentle, DW faithful. I'm a n00b to this entire field and use of PHP, DW, etc. I have a few questions....I'm using ~2008 Macbook Pro, DW5, and MAMP.

 

Set up my site with PHP files, got a local test up and running, got the Recordsets/Queries to look and function the way I like off my local server. In other words, the site workds great locally. Signed up for bluehost to act as my remote , uploaded all the files fine. BUT, when I went to view my site on the remote server, the php pages that are restricted to members just don't display at all (HTTP 500 error). I'm assuming it's not a coding error as the pages display properly on the local, but not the remote (therefore, a DB connection issue). Here's what I've done to try and remedy.

 

  • Exported DB from local, Imported to Remote (so its structured/named the exact same aside from the host-insterted characters before it)
  • Enabled my IP to update the site remotely from host cPanel (my C-Class?)

 

The first line of PHP code on all of these member restricted pages starts with:

 

<?php require_once('../Connections/TBO_Golf.php'); ?>

 

The 'TBO_Golf.php' contains:

 

<?php

#  FileName="Connection_php_mysql.htm"

#  Type="MYSQL"

#  HTTP="true"

$hostname_TBO_Golf = "localhost";

$database_TBO_Golf = "TBO_Golf"

$username_TBO_Golf = " **** "

$password_TBO_Golf = " **** "

$TBO_Golf = mysql_pconnect($hostname_TBO_Golf, $username_TBO_Golf, $password_TBO_Golf) or trigger_error(mysql_error(),E_USER_ERROR);

?>

 

Question 1) - I'm pretty sure that with the files on the remote server, they run the script trying to connect to a 'localhost', which is causing my error. Do I change the settings in the connection file or in the database connection window to what will work for my remote server? I know what they are as I created a second database connection to the remote (so now I have one for local and remote) Do I have to "re-do" the queries using a connection to the remote?

 

Question 2) Is changing the settings like this the best practice when moving from locally proven to remote (and from remote to local for testing) with respect to displaying dynamic pages? If not, what is?

 

Question 3) In my attempt to research, I read somewhere that DW can't handle more than one database connection at a time. I find this hard to believe, so is there any truth to this?

 

If anyone can help, this will be greatly appreciated!!!

 

Thanks in advance!!

 
Replies
  • Currently Being Moderated
    Jul 19, 2012 12:39 PM   in reply to ssj111mike

    1.  Localhost is a common connection in shared hosting environments.  You can double check with Bluehost, but I believe they use localhost.

     

    2.  Not 100% sure what you are asking here. 

     

    3.  DW can handle multiple database connections, but why do you need to connect to multiple databases?  This is more a question of database design then it is about the data.

     

    To go back to your original issue, a 500 error can be a result of a few causes.  One is bad htaccess file so if you are doing rewriting of URLs check that.  Also, check your error logs on the server (your host can tell you the location) and that can shed some light on what is causing the 500 error.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 20, 2012 9:52 AM   in reply to ssj111mike

    Firstly, you may not realize it but Dreamweaver has you using the ancient mysql extension, which NO ONE SHOULD EVER USE ANY LONGER. Use the Mysqli extension or PDO. However, it makes sense to go ahead and verify that you CAN connect to the external DB first. In other words, solving problem 1. And for this issue, I don't have any suggestions.

     

    2. Typically you have a file outside your web root (looks like you've done that ...Connections) that provides the database log-in. This file can be very different on the local system from the external system, but as long as they use the same file name, you don't have to keep track of them. One thing I do is set verbose error messages on for the local system and no error messages for the external system.

     

    3. Be aware that there is a security issue when doing this. Normally you don't want to let your external DB connect outside the server through http. Your webhost may not even allow it.  In cPanel, see if you have an option for REMOTE MYSQL. You can enter the ip address of your internet connection here to allow the DB to communicate with your local system.

     

    I don't use the DW database tools just because I prefer to write all my own code and do things my way, so I don't know if you can do this through the DW database tools. But what I do is simply export the external database (as SQL) and replace the local DB with it. This allow you to make changes to both structure and data without being concerned that you are going to mess up your live database.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points