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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:36:34+00:00 2026-06-12T09:36:34+00:00

I try to define a deployment procedure based on command : php <phar_file_deployed_on_server>.phar This

  • 0

I try to define a deployment procedure based on command :

php <phar_file_deployed_on_server>.phar

This command generates an index.php file external to phar archive.

The index.php file will act as a “thin” dispatcher to N-file.php inside the phar archive.

Example of generated index.php file :

<?

$requiredFile = "phar://<phar_file_deployed_on_server>.phar";

/**
 * For example index.php can check $_GET array and dispatch 
 * to file inside Phar archive.
 **/
if (array_key_exists("getParameter", $_GET))
    $requiredFile = $requiredFile . "/" . $_GET['getParameter'] . ".php";
else
    <handling_of_else_condition>;

require_once $requiredFile;

__HALT_COMPILER();

?>

The above dispathing rule is an example.

My idea is oriented to simply the deployment procedure. The example provided check $_GET array, but it’s possible a more complex rule generated during deployment (e.g. via command line parameter).

I have created a PHP web application and compressed it to the Phar
format for easy deployment.

The application can be executed without decompression on a production
machine, because I have planned an index.php file that links to the
application inside the Phar archive.

To generate the index.php file during deployment, it is necessary to
launch the following command into production machine shell:

php <just_deployed_phar_file>

The code inside the stub file generates the index.php file in manner
to refer to the just installed Phar archive.

Is this the correct way to use the stub file?

  • 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-12T09:36:35+00:00Added an answer on June 12, 2026 at 9:36 am

    You can use the stub file to do whatever you want to do. When the phar is executed (with php xxx.phar)
    If I get your question right, you’re planning to use your phar file as an installer for your whole application. It installs the index.php and then uses the phar to load your application. That would do its job, but there is a better way:

    I think you’re searching for webPhar, which acts like a frontcontroller for your application. If you use webPhar() in the stub of your phar the request from your webserver is routed to your phar.

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

Sidebar

Related Questions

So I have this function: (define (try try-block catch-block finally-block) ; Implements try/catch/finally like
I try to define the Reader monad with scalaz like this: import scalaz._ import
If I try to define a simple table as this: create table test (
I try to define a constructor for C++ struct , and coincidently, this is
I have a header menu and try to define different CSS classes for each
I know how to do a global variable, but whenever I try to define
I get this error FB is not defined when i try to run this
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]
try: recursive_function() except RuntimeError e: # is this a max. recursion depth exceeded exception?

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.