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 7986283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:48:47+00:00 2026-06-04T11:48:47+00:00

I am trying to get the build number available in the php instance. I

  • 0

I am trying to get the build number available in the php instance. I will use it as a type of “cache-buster” for the static assets (css, js). Is there any way to get it at run time?
If not, is there a way to get it at build time in the postinstall script?

  • 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-06-04T11:48:49+00:00Added an answer on June 4, 2026 at 11:48 am

    I see a couple of ways you could do this.

    1. In /home/dotcloud/ the code directory is a symlink to the build version, so for example my code directory points to git-16ae997. In your postinstall script if you get the name of that directory and store it in a temp file, env variable, or maybe inject it into one of your config scripts, you could reference it from your program.

    Putting this in your postinstall script will add the BUILD_VERSION variable to your .profile and be available to you from $BUILD_VERSION in a shell, or other languages. You might need to re-source the .profile after you make the change to be sure it gets set.

    $ echo "export BUILD_VERSION=`readlink /home/dotcloud/code`" >> /home/dotcloud/.profile
    
    $ echo $BUILD_VERSION
    

    With PHP you should be able to get it at runtime with the following variable.

    $_ENV["BUILD_VERSION"]
    
    1. Another approach I have used myself on other projects is to create .version file in the postinstall that just includes the timestamp of the build, and reference that file for the build_version and use it as your cache-buster. The problem with this approach is because it is created at postinstall if you scale above 1 instance, you will most likely end up with different timestamps for each instance, and I’m guessing this isn’t what you want.

      $ date ‘+%s’ > /home/dotcloud/.version

    I would stick with #1 since it works when you scale, and it is more strait forward.

    Hope that helps.

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

Sidebar

Related Questions

I'm trying to get my build number into the web.config of an ASP.Net MVC
I'm trying to get build a simple Active Directory tools that allows me to
I am trying to get a build process set up in TeamCity 5, and
I'm struggling a lot trying to get our build server going. I am currently
I have a solution I'm trying to get to build on TFS. I want
I'm trying to get my commit-build.bat to execute other .BAT files as part of
Trying to get MGTwitterEngine app to build. Getting one pesky error. The following ERROR.
I'm trying to get a target to build that has quite a long list
I'm trying to get title of simple html document to build sitemap. But always
Trying to build my project with ANT in idea 10 and I get a

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.