[英]PHP: Phing, Phar, and phar.readonly
I'm using the PHP build system phing
to create a phar
archive file.我正在使用 PHP 构建系统
phing
创建一个phar
存档文件。
Is there any known science that will let me automatically set the phar.readonly
to 0
(which will allow the creation of phar
to know) during a run of phing
, but leave it set to 0
at all other times?是否有任何已知的科学可以让我在
phing
运行期间自动将phar.readonly
设置为0
(这将允许phar
的创建知道),但在所有其他时间将其设置为0
?
phar.readonly
can only be set in PHP.INI phar.readonly
只能在 PHP.INI 中设置
Their documentation says it can be set by ini_set()
("phar.readonly "1" PHP_INI_ALL"), but it cannot.他们的文档说它可以由
ini_set()
("phar.readonly "1" PHP_INI_ALL") 设置,但它不能。
$ php -r "ini_set('phar.readonly',0);print(ini_get('phar.readonly'));" 1
Update from http://php.net/manual/en/phar.configuration.php从http://php.net/manual/en/phar.configuration.php更新
This setting can only be unset in php.ini due to security reasons.
出于安全原因,此设置只能在 php.ini 中取消设置。 If phar.readonly is disabled in php.ini, the user may enable phar.readonly in a script or disable it later.
如果在 php.ini 中禁用了 phar.readonly,用户可以在脚本中启用 phar.readonly 或稍后禁用它。 If phar.readonly is enabled in php.ini, a script may harmlessly "re-enable" the INI variable, but may not disable it.
如果在 php.ini 中启用了 phar.readonly,脚本可能会无害地“重新启用”INI 变量,但可能不会禁用它。
short answer: You should set phar.readonly
the parameter in your php.ini file from 1 to 0.简短回答:您应该将 php.ini 文件中的参数
phar.readonly
设置为 1 到 0。
long answer: I have my PHP running on docker and for rewrite phar.readonly
, I set an INI file in the dockerfile长答案:我的 PHP 在 docker 上运行,为了重写
phar.readonly
,我在 dockerfile 中设置了一个 INI 文件
RUN echo 'phar.readonly=0' >> /usr/local/etc/php/conf.d/docker-php-phar-readonly.ini
docker will read every INI file that you put in /usr/local/etc/php/conf.d/
folder and will rewrite php.ini with these parameters docker 将读取您放入
/usr/local/etc/php/conf.d/
文件夹中的每个 INI 文件,并使用这些参数重写 php.ini
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.