PHP ini 文件和会话删除
发布了一个关于错误的问题,我在处理图像调整大小时遇到了有关内存超出的问题。
设法用本地 php.ini 文件和设置解决问题
[PHP]
upload_max_filesize = 5M
post_max_size = 5M
memory_limit = 64M
现在我意识到我遇到了一个全新的问题:)
如果我使用自定义本地 php.ini 访问目录中的 php 文件,它将覆盖原始文件并 删除所有 $_SESSION
如果我删除本地 php.ini,它不会删除我的会话,但图像调整大小会给我一个内存限制超出错误。
有什么想法吗?我可以设置 php.ini (本地)来覆盖我想要的 3 个参数吗?
预先感谢,
Ps 尝试通过调整 php.ini 上的 CPANEL 设置它,但这些值似乎被忽略。
结果
必须联系技术支持,他们必须手动更新我的 ini 文件。
Posted a question about an error I was getting the over day about Memory exceed when handling an image resize.
Managed to solve the problem with a local php.ini file and setting
[PHP]
upload_max_filesize = 5M
post_max_size = 5M
memory_limit = 64M
Now I realised I have a whole new problem :)
If I access a php file in the directoy with my custom local php.ini, it will override the original and
remove all my $_SESSION's
If I remove the local php.ini, it doesnt remove my sessions but then the image resize gives me a memory limit exceed error.
Any ideas? Can i set a php.ini (local) to just override the 3 parameters I want?
Thanks in advance,
P.s. tried setting it through CPANEL on tweak php.ini but those values seemed to be ignored.
Result
Had to contact tech support and they had to manually update my ini files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你对你的服务器有完全的控制权,在大多数 Linux 发行版上都有一个 conf.d 目录,它会在所有默认的 php 配置之后加载,所以你可以覆盖一些东西。例如,在 ubuntu 上,即
/etc/php5/conf.d/
,您可以在其中创建一个文件“my.ini”(只要以 .ini 结尾,名称并不重要)它将自动包含在内。如果您无权访问整个服务器,有几种方法可以在不覆盖所有内容的情况下进行更改:
ini_set('option', 'value ');
在你的 php 脚本中如果你要使用 .htaccess 路由,这里有一个例子,只需附加到 .htaccess 文件的末尾:
If you have full control over your server, on most linux distros there is a conf.d directory which is loaded after all of the default php configuration, so you can override things. On ubuntu for example, that is
/etc/php5/conf.d/
, there you can create a file 'my.ini' (name doesn't matter as long as it ends in .ini) which will be automatically included.If you don't have access to the entire server, there are several ways of altering those without overwriting everything:
ini_set('option', 'value');
in your php scriptIf you're going for the .htaccess route, here is an example, just append to end of your .htaccess file: