Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 486619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:31:18+00:00 2026-05-13T01:31:18+00:00

Hey everyone, some background info: In the config file for my website, I set

  • 0

Hey everyone, some background info:

In the config file for my website, I set the mysql database name, username and password based on the contents of $_SERVER['HTTP_HOST']. Because it is possible for this variable to not be set in the case of old (HTTP 1.0) requests and cron jobs, I include a file that spoofs the $_SERVER['HTTP_HOST'] value based on the value found in $_SERVER['SCRIPT_FILENAME'].

However, I’m still noticing errors in my log files every now and then (it’s rare, once every 2 weeks or so, but it still happens) where it tries to connect to MySQL on the production site using the login information for the local testing environment.

Is there a possibility for $_SERVER['SCRIPT_FILENAME'] to be empty?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:31:19+00:00Added an answer on May 13, 2026 at 1:31 am

    I believe this is possible depending on the webserver being used and its configuration but this wouldn’t happen inconsistently i.e. it wouldn’t just happen ‘once every 2 weeks or so’ it would happen on every request.

    A more robust solution to your problem would be to modify your deployment process (or implement one if you don’t have a formal process). The deployment scripts could write appropriate connection parameters to your config file depending on which environment is being deployed to.

    A new deployment process as suggested would then turn this run-time issue into a deploy-time issue which hopefully would be identified and acted upon quickly in the case of a mistake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone I am currently getting the next variable based on if a file
Hey everyone. While I'm trying to learn some PHP and mySQL, I ran into
Hey everyone, great community you got here. I'm an Electrical Engineer doing some programming
hey everyone... so i'm working on a database design class for university. I've got
Hey everyone. I am having some issues on my end and hopefully it's just
Hey everyone, I have written a script that downloads a zip file from a
Hey everyone I am a newbie and would love some help. I got the
Hey everyone, I am trying to ( temporarily! ) do some ASP.NET and C#
Hey everyone I am building a website that needs to have the capability to
Hey everyone, I have a database result that returns from a method. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.