Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

phar.getstub(3) [php man page]

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.INTERCEPTFILEFUNCS(3)						 1						PHAR.INTERCEPTFILEFUNCS(3)

Phar::interceptFileFuncs - instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions

SYNOPSIS
finalpublicstatic void Phar::interceptFileFuncs (void ) DESCRIPTION
instructs phar to intercept fopen(3), readfile(3), file_get_contents(3), opendir(3), and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file within the phar archive. Absolute paths are assumed to be attempts to load external files from the filesystem. This function makes it possible to run PHP applications designed to run off of a hard disk as a phar application. PARAMETERS
No parameters. RETURN VALUES
EXAMPLES
Example #1 A Phar.interceptFileFuncs(3) example <?php Phar::interceptFileFuncs(); include 'phar://' . __FILE__ . '/file.php'; ?> Assuming that this phar is at /path/to/myphar.phar and it contains file.php and file2.txt, if file.php contains this code: Example #2 A Phar.interceptFileFuncs(3) example <?php echo file_get_contents('file2.txt'); ?> Normally PHP would search the current directory for file2.txt, which would translate as the directory of file.php, or the current direc- tory of a command-line user. Phar.interceptFileFuncs(3) instructs PHP to consider the current directory to be phar:///path/to/myphar.phar/ and so opens phar:///path/to/myphar.phar/file2.txt in the above example code. PHP Documentation Group PHAR.INTERCEPTFILEFUNCS(3)
Man Page

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PHP rpm problem

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)
Discussion started by: superprogrammer
2 Replies

2. UNIX for Advanced & Expert Users

Compile error for PHP with msql

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)
Discussion started by: brizrobbo
1 Replies

3. Web Development

Need Number Format Help in PHP

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)
Discussion started by: RacerX
2 Replies

4. Red Hat

php file is not executed

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)
Discussion started by: phpalerts
5 Replies

5. Web Development

Validation in php help !

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)
Discussion started by: gameboy87
2 Replies

6. UNIX for Dummies Questions & Answers

download di file di testo

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)
Discussion started by: valei
1 Replies

7. Shell Programming and Scripting

Request to check run php in Unix shell

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)
Discussion started by: manigrover
6 Replies

8. Emergency UNIX and Linux Support

Migration of website... PHP/Mysql -which path for DB.php

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)
Discussion started by: Astrocloud
15 Replies

9. Shell Programming and Scripting

Search for / and insert \ for every instance

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)
Discussion started by: deadyetagain
4 Replies

10. Shell Programming and Scripting

Test Server - Forum Code Changes for PHP 5.3.10 to PHP 7

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)
Discussion started by: Neo
7 Replies