PHAR.GETSTUB(3) 1 PHAR.GETSTUB(3)Phar::getStub - Return the PHP loader or bootstrap stub of a Phar archive
SYNOPSIS
public string Phar::getStub (void )
DESCRIPTION
Phar archives contain a bootstrap loader, or stub written in PHP that is executed when the archive is executed in PHP either via include:
<?php
include 'myphar.phar';
?>
php myphar.phar
RETURN VALUES
Returns a string containing the contents of the bootstrap loader (stub) of the current Phar archive.
ERRORS /EXCEPTIONS
Throws RuntimeException if it is not possible to read the stub from the Phar archive.
EXAMPLES
Example #1
A Phar.getStub(3) example
<?php
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
echo $p->getStub();
echo "==NEXT==
";
$p->setStub("<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER(); ?>");
echo $p->getStub();
?>
The above example will output:
<?php __HALT_COMPILER(); ?>
==NEXT==
<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER(); ?>
SEE ALSO Phar.setStub(3), Phar.createDefaultStub(3).
PHP Documentation Group PHAR.GETSTUB(3)
Check Out this Related Man Page
PHAR.CREATEDEFAULTSTUB(3) 1 PHAR.CREATEDEFAULTSTUB(3)Phar::createDefaultStub - Create a phar-file format specific stub
SYNOPSIS
finalpublicstatic string Phar::createDefaultStub ([string $indexfile], [string $webindexfile])
DESCRIPTION
This method is intended for creation of phar-file format-specific stubs, and is not intended for use with tar- or zip-based phar archives.
Phar archives contain a bootstrap loader, or stub written in PHP that is executed when the archive is executed in PHP either via include:
<?php
include 'myphar.phar';
?>
php myphar.phar
This method provides a simple and easy method to create a stub that will run a startup file from the phar archive. In addition, different
files can be specified for running the phar archive from the command line versus through a web server. The loader stub also calls
Phar.interceptFileFuncs(3) to allow easy bundling of a PHP application that accesses the file system. If the phar extension is not present,
the loader stub will extract the phar archive to a temporary directory and then operate on the files. A shutdown function erases the tempo-
rary files on exit.
RETURN VALUES
Returns a string containing the contents of a customized bootstrap loader (stub) that allows the created Phar archive to work with or
without the Phar extension enabled.
ERRORS /EXCEPTIONS
Throws UnexpectedValueException if either parameter is longer than 400 bytes.
EXAMPLES
Example #1
A Phar.createDefaultStub(3) example
<?php
try {
$phar = new Phar('myphar.phar');
$phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php'));
} catch (Exception $e) {
// handle errors
}
?>
SEE ALSO Phar.setStub(3), Phar.getStub(3).
PHP Documentation Group PHAR.CREATEDEFAULTSTUB(3)
I did not know where to ask this problem so posting it here
The version of php used is 4.3.2.
1. If I say rpm -qa | grep php, I get mod_php4-4.2.2 and mod_php4-core-4.2.2
If I do php -v, I get 4.3.2. How could that be possible? I am sure the version which is being used is 4.3.2.
2. The... (2 Replies)
Hi Folks,
I am trying to phpize miniSQL with PHP 5.2.4 on Solaris (SPARC) using GCC 3.4.6.
- Unpacked the PHP source to /softwareArchive/php-5.2.4.
- Navigated to /softwareArchive/php-5.2.4/ext/msql.
- Ran #phpize, then #./configure --with-msql, which worked fine.
However when I make, i... (1 Reply)
I have a number coming into a php echo statement that looks like 0293 and i want to output it looking like 29.3 and for the life of me i cannot figure out how to do it with available php functions like number_format, sprintf, or printf.
Sample Data:
0293
0304
0282
0310
1324
2000
... (2 Replies)
hello
i have installed php on my FC 10 Machine and made the necessary changes.
like:-
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
in the "httpd.conf"
But when i run php file it opens file as "Save As" dialogue box.
anyone can guess why ?... (5 Replies)
I am validating a form using php script and I want to "echo" the error message near to the text box itself & not below all the controls....Can I Position the display messages ?..Pls help me... (2 Replies)
Hi everybody,
I'm new on this forum and I hope to use it correctly.
My question is: I have to download from a bash script the text file at the following page:
opm.phar.umich.edu/subunits.php
How can I do it? The wget function downloads the html code, while I want to get the text file only. Does... (1 Reply)
Hi I m running a php file in Unix shell
it says php cpmmnad not found
bash-3.2$ cat echo.php
<? php
echo"heelo world"
>?
bash-3.2$ php echo.php
bash: php: command not found
actually I want to change certain thing a in a website using php script so I m beginner and trying... (6 Replies)
Hi,
I have two websites:
website1.com and website2.com
I didn't write either but have successfully moved all the files from website1.com to website2.com
I (thought) I installed all the correct php modules and website2 is mostly up and running. However, my boss found that when we go to a... (15 Replies)
Hi,
I want to do a sed (linux) or the alternative in PHP to insert a backslash in front of every occurrence of every forward slash
ex.
/archive/data/stanley
-->
\/archive\/data\/stanley
I appreciate it! (4 Replies)
Here is some docs of my ongoing work to port this forum PHP code which is running on 5.3.10, to PHP 7.
Motivation:
Unfortunately, every thing that has a beginning must have an end. PHP 5.6 active support ended January 19, 2017. It will receive security support until December 31, 2018.
#1 ... (7 Replies)