服务器重写的php.ini [英] Overriding php.ini on server

查看:407
本文介绍了服务器重写的php.ini的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,它允许用户上传图片。

I have a page which allows users to upload images.

当用户试图尽管上传较大的图像它返回一个500错误。

It is returning a 500 error when the user tries to upload larger images though.

下面code ...

The following code...

<?php echo ini_get("upload_max_filesize"); 
echo ini_get("post_max_size"); 
echo ini_get("max_input_time");
echo ini_get("max_execution_time");
?>

......返回:

...returns:

100M
100M
60
3600

我是从这个猜测,它的最大输入时是造成这个问题,因为我已经下100MB的文件进行测试,但花费的时间超过60秒上传。

I'm guessing from this that it's the max-input-time that's causing the problem as i've tested with files under 100mb but taking longer than 60 seconds to upload.

我没有和我的主机php.ini文件存取,这样我就可以覆盖这些设置?我尝试添加一个htaccess文件,但我不知道我已经把它在正确的位置。

I don't have access with my host to the php.ini file, so can I override these settings? I've tried adding an htaccess file but I'm not sure I've put it in the correct place.

推荐答案

把你的网站(如你的PHP脚本)的根文件夹中的.htaccess文件,并添加以下值:

Put a .htaccess file in the root folder of your website (where your php script is) and add the following values:

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 200
php_value max_input_time 200

当然,你可以把其他的大小和时间的限制。这应该工作。

Of course, you can put other size and time limits. That should work.

这篇关于服务器重写的php.ini的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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