如何在PHP中覆盖register_argc_argv? [英] How to override register_argc_argv in PHP?

查看:154
本文介绍了如何在PHP中覆盖register_argc_argv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用共享主机(fasthostingdirect),由于某种原因,它们默认情况下已关闭此标志.这意味着我无法访问PHP命令行参数...除非在php.exe之后使用-n(= --no-php-info)标志.

I'm using a shared host (fasthostingdirect) and for some reason they have this flag turned off by default. This means I'm unable to access PHP command line parameters... unless I use the -n (= --no-php-info) flag after php.exe.

在我的php文件中尝试了ini_set('register_argc_argv', 1),但没有任何效果.我猜这是由于托管服务提供商的严格限制所致,但是他们没有停止-n选项-尽管不确定使用此选项的其他含义.有人有更好的建议吗?

Have tried ini_set('register_argc_argv', 1) in my php file but it has no effect. Am guessing this is due to the clamped down nature of the hosting provider, however they don't stop the -n option - not sure of the other implications of using this though. Does anyone have any better suggestions?

推荐答案

ini_set('register_argc_argv', 1)不起作用,因为在执行代码时,它们已经被注册(或未注册).

The ini_set('register_argc_argv', 1) does not work because by the time the code is executed, they have already been registered (or not).

似乎您可以直接运行php,因此复制您自己的php.ini文件并传递给它:

It seems you are able to run php directly, so copy your own php.ini file and pass it:

php -c yourphp.ini

这篇关于如何在PHP中覆盖register_argc_argv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆