Jump to content
Larry Ullman's Book Forums

Vps Not Passing Config Variables/functions


Recommended Posts

I am experimenting with a Linux GoDaddy VPS (apache 2.4.12 php5.5.27) and examples from this book. It is partially working. (I should add that I did not have this problem with WAMP on Win7). I understand Larry's suggestions of not developing online, however I wish to deal with it's drawbacks.  

My index.php page seems to pull all of the correct config.ini/mysql.ini/header.html/footer.html files and open up correctly with no errors. It appears to be connected to the database. 

However, when I attempt to submit a login, or a new "create account", the login.inc.php and register.php are not seeing the variables or functions (escape_data) from mysql.inc.php . I get a "Fatal error. Call to undefined function escape_data() in...". It's as if when secondary php files are ran (php files that are called after the initial index page) that the configuration php files aren't carried over into them. The variables and functions aren't recognized. 

I do not feel this is a code or call to function issue. I can re-write (re-define) the escape_data() function within the login.inc.php and then I get an undefined variable error, as if $dbc then does not exist. It's just not pulling the code over from mysql.inc.php. 

I feel this has something to do with the VPS configuration. ? Maybe the session configuration? Some akward security setting within GoDaddy?

Any direction for information on something like this would be appreciated. 

Thanks!,

- Carl

Link to comment
Share on other sites

Um...this is pretty hard to debug like this, but if this were me and a specific error you got was "Fatal error. Call to undefined function escape_data() ...", I'd start by fixing that error. If you then get an undefined variable error on $dbc, I'd debug that. It's possible there's something systemic to blame, but your error messages are all you have to go on, so you'll want to debug from those perspectives.

 

The other ideas--sessions, security settings, etc.--are really grasping at straws, as there's no good way to pursue those avenues.

Link to comment
Share on other sites

Thank you for the response Larry, I really appreciate it. Haha, yeah, it sounds exactly like I'm grasping at straws, until my brain hurts. ! 

Here's the thing - this works fine on my local WAMP setup, no errors. How can I fix the code error, if there is no code error? Doesn't this mean it has to be some kind of configuration problem?

Link to comment
Share on other sites

Voilà. Problem solved. This happened because of an incorrect BASE_URI path in my config.ini.php file. Silly error on my part.

Problem from -  

  define ('BASE_URI', 'http://www.website.com/includes/');

  define ('BASE_URL', 'http://www.website.com/'); 

Solved by - 

  define ('BASE_URI', '/home/website/html/includes/');
  define ('BASE_URL', 'http://www.website.com/');

Thank you again Jonathan and Larry for the help and information. Hopefully this post will help others.

 
Link to comment
Share on other sites

That's good to know and thanks for sharing the solution. A takeaway here that I'd like to stress is the importance of trusting the errors. Developers will see similar situations with databases, where the live server doesn't have the same database or database users, which causes connection errors. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...