PHP creates a phar document, which has many incomprehensions and reports an error.

Source: Internet
Author: User
I want to package the index. php file into a phar file. The file organization is as follows: index. php and 1. php are in the same directory. There is only one helloworld in index. php, and the code in 1. php is like this: {code...}. The running result returns an error: Why? $...

I want to package the index. php file into a phar file:
The file organization is as follows:

Index. php and 1. php are in the same directory.
There is only one hello world in index. php.
The code in 1.php is as follows:


  buildFromDirectory(dirname(__FILE__) . '/index.php');$phar->setStub($phar->createDefaultStub('1.php', '1.php'));$phar->compressFiles(Phar::GZ);

The following error is returned:

Why is it wrong?
$ Phar-> setStub ($ phar-> createdefastustub ('1. php', '1. php'); is the parameter incorrect?
What is this stub?
This 1. Can php be run directly or by using the php Command Line?
How can this problem be solved?

Reply content:

I want to package the index. php file into a phar file:
The file organization is as follows:

Index. php and 1. php are in the same directory.
There is only one hello world in index. php.
The code in 1.php is as follows:


  buildFromDirectory(dirname(__FILE__) . '/index.php');$phar->setStub($phar->createDefaultStub('1.php', '1.php'));$phar->compressFiles(Phar::GZ);

The following error is returned:

Why is it wrong?
$ Phar-> setStub ($ phar-> createdefastustub ('1. php', '1. php'); is the parameter incorrect?
What is this stub?
This 1. Can php be run directly or by using the php Command Line?
How can this problem be solved?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.