Home > Article > Backend Development > About php packaging and unpacking Phar
Recently I used php to connect to hive and found php-thrift-sql (https://github.com/Automattic/php-thrift-sql). I found a sentence in the readme:
The first contact was with Boss Han. Create swooole packaging article
php -c php.ini build.php
Because phar.readonly in php.ini is on by default, and we need to unpack and package it here, so we need to configure it as follows
[Phar] ; http://php.net/phar.readonlyphar.readonly = Off ; http://php.net/phar.require-hash;phar.require_hash = On ;phar.cache_list =
We see that there is a ThriftSQL.phar in the code. If you want to know how to use it, you should look at the source code. So how to unpack it?
<?php$phar =new Phar("./ThriftSQL.phar"); $re=$phar->extractTo("Thrift-origin"); var_dump($re);
If the unpacking is correct, it will return true, so there will be one more Thrift-origin file in the path.
php returned.php bool(true) root@tongbo:/home/tb/tmpdown# lsci_3.1.30 ci.zip php-thrift-sql returned.php Thrift-origin ThriftSQL.phar root@tongbo:/home/tb/tmpdown#
Enter Thrift-origin and you can see the specific php code.
Recommended: "PHP Tutorial"
The above is the detailed content of About php packaging and unpacking Phar. For more information, please follow other related articles on the PHP Chinese website!