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

  • Home
  • SEARCH
  • 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 425571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:23:35+00:00 2026-05-12T19:23:35+00:00

I have a small script and want to detect the script version from admin

  • 0

I have a small script and want to detect the script version from admin footer. On the admin footer.php I put this code.

<?php
  define('VERSION', '1.0');
  $fp = fopen("http://v.domain.com/version.txt", "r");
  while ($line = fgets($fp)) {
      $line;
      if (VERSION != $line) {
?>
<div id="upgrade">
<a href="http://domain.com/download/" target="_blank">Download a new version [<?php echo $line; ?>]</a>
</div>
<?php
      }
  }
?>

In the version.txt only have 1.0.1 and working fine to compare the version.

Problem here, client site will getting slow. How to fix this problem?

  • 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-12T19:23:35+00:00Added an answer on May 12, 2026 at 7:23 pm

    The reason it is slow is because the server running your PHP code has to hit v.domain.com over HTTP and download a copy of version.txt. While this is happening, the PHP is sitting there waiting on it.

    Why does this make your entire page slow even though it’s in the footer? Because Apache will cache the output of the PHP page for a bit before spitting it out to the browser. And even if you flush the output buffer, sometimes the browser does and that’s something you have no control over.

    It sounds like you want to release some PHP-based tool, and have an auto-version-check in the footer, correct?

    If so, there are a couple problems with doing it the way you’re doing it:

    1. There’s no need to check the version every single time your page loads. Save the last date you checked somewhere, and only check again ___ days later. (Hopefully you are already doing this and just cut it from the example for simplicity)

    2. Reading the file like this from another server is a bad idea. As you’re experiencing now, it can cause a slowdown if your v.domain.com gets busy. If it goes down, then your PHP will take even longer because it’s waiting on a timeout.

    A better way to do this would be through Javascript. After your page is loaded, you would have a javascript function that uses AJAX. If you are unfamiliar with Javascript though there could be a bit of a learning curve, but this is the ideal way to handle your situation.

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

Sidebar

Ask A Question

Stats

  • Questions 222k
  • Answers 222k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Take a look at the \dt command at http://www.postgresql.org/docs/8.4/interactive/app-psql.html You… May 13, 2026 at 12:28 am
  • Editorial Team
    Editorial Team added an answer You move an OpenLayers.Feature.Vector object by calling methods on its… May 13, 2026 at 12:28 am
  • Editorial Team
    Editorial Team added an answer You should be able to adapt the example code here… May 13, 2026 at 12:28 am

Related Questions

I have written a small Perl script and now I would like to create
I have a small script that I use to resize all of the images
I have a Mac OS X application in the standard .app format and was
In SCons, my command generators create ridiculously long command lines. I'd like to be

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.