简体   繁体   English

修改php.ini而不编辑实际文件

[英]Modifying php.ini without editing the actual file

is that even possible?.. OsCommerce need these settings, 可能吗?.. OsCommerce需要这些设置,

register_globals --> on magic_quotes_gpc --> off register_globals->打开magic_quotes_gpc->关闭

but unfortunately I am not allowed to edit the php.ini file because of shared hosting.. is any otherway to do it? 但是不幸的是,由于共享主机,我不允许编辑php.ini文件。还有其他方法吗? I got only FTP access. 我只有FTP访问。

edit: 编辑:

PHP Version 5.2.17 PHP版本 5.2.17

Server API CGI/FastCGI 服务器API CGI / FastCGI

You can try using "ini_set" at the top of your PHP script. 您可以尝试在PHP脚本顶部使用“ ini_set”。

Documentation for ini_set is here: http://www.php.net/ini_set ini_set的文档在这里: http ://www.php.net/ini_set

I am not sure how OsCommerce works, but hopefully there is a main index.php file, and you would only have to modify that one. 我不确定OsCommerce的工作方式,但希望有一个主要的index.php文件,您只需要修改该文件即可。

Worst case scenario is that there is a mass of PHP files everywhere that would need to be modified. 最坏的情况是,到处都有大量的PHP文件需要修改。

Not all ini variables are changeable through ini_set. 并非所有ini变量都可以通过ini_set更改。 But some variables canbe changed in a custom php.ini. 但是某些变量可以在自定义php.ini中进行更改。

In this case, you can't change magic_quotes_gpc and register_globals through ini_set() but you are allowed to change in PHP_INI_PERDIR , that is, if your server allows you to create a custom php.ini, then you can change it there. 在这种情况下,您不能通过ini_set()更改magic_quotes_gpcregister_globals ,但可以在PHP_INI_PERDIR进行更改,也就是说,如果您的服务器允许您创建自定义php.ini,则可以在其中进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM