简体   繁体   English

使用.htaccess编辑php.ini

[英]Edit php.ini with .htaccess

I'm slowly getting back into PHP, and now I run into a problem, I want to install some web software on our host and I need to have either the latest Zend (which they don't have) or IonCube on the server and IonCube requires enable_dl to be on in the php.ini. 我慢慢地回到PHP,现在遇到了一个问题,我想在主机上安装一些Web软件,并且需要在服务器上安装最新的Zend(他们没有)或IonCube, IonCube要求在php.ini中启用enable_dl。 Now a colleague of mine thinks I can update this via an .htaccess file on the server. 现在,我的一位同事认为我可以通过服务器上的.htaccess文件进行更新。 So I created a s.htaccess on my machine as Windows doesn't like emptiness before the file extension. 所以我在计算机上创建了一个s.htaccess文件,因为Windows不喜欢文件扩展名之前的空白。 So I added the line php_flag enable_dl On to the file uploaded it and renamed the file to just .htaccess on the server. 因此,我将php_flag enable_dl On行添加到上传的文件中,并将文件重命名为服务器上的.htaccess。 When I refresh the file is gone, when I keep it as s.htaccess it's fine but my php info still shows it as Off. 当我刷新文件不见了时,当我将其保存为s.htaccess时就可以了,但是我的php信息仍然显示为Off。

What n00b mistake am I making? 我在犯什么错误?

The documentation says that this can only be set in the php.ini (not in .htaccess). 文档说只能在php.ini中设置(不能在.htaccess中设置)。 You can see this by looking at the table where it says "PHP_INI_SYSTEM", which means - "Entry can be set in php.ini or httpd.conf". 您可以通过查看显示为“ PHP_INI_SYSTEM”的表来看到它,这意味着-“可以在php.ini或httpd.conf中设置条目”。

Unix way to hide files is prepending it with a dot. Unix隐藏文件的方法是在文件名前加点。 The file is there, but it's just hidden. 该文件在那里,但是只是隐藏的。 Your ftp-software should have a setting for showing hidden files. 您的ftp软件应该具有显示隐藏文件的设置。 IIRC you can rename the file to .htaccess through cmd in windows. IIRC,您可以通过Windows中的cmd将文件重命名为.htaccess。 The .htaccess only has effect in the current dir and sub directories. .htaccess仅在当前目录和子目录中有效。 This might also be (because of security) one of those settings that is only setable through php.ini (出于安全考虑)这可能也是只能通过php.ini进行设置的那些设置之一

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

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