在Linux服务器上修改文件上传大小 [英] Change file upload size in linux server

查看:492
本文介绍了在Linux服务器上修改文件上传大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要上传带有34MB的PDF文件。我的网站是在Linux下用PHP。但是,我的网站只支持8MB。 (我知道这从的phpinfo)。我如何增加大小?我heared,我们可以通过在php.ini中改变它。 htaccess的。但是,在我得到的php.ini?我如何改变大小?是否有任何人给我一个解决方案吗?

I have to upload a pdf file with 34MB. My site is in Linux with php. But my site support only 8MB. (I know this from phpinfo). How I increase the size? I heared that we can change it in php.ini through. htaccess. But where I get php.ini? How I change the size?. Does any one give me a solution ?

推荐答案

有可能影响最大文件上传大小多项设置:

There are multiple settings that can affect the maximum file upload size:

PHP_INI_PERDIR:下面的设置可以在php.ini,的.htaccess或httpd.conf中设置:

PHP_INI_PERDIR: The following settings can be set in php.ini, .htaccess or httpd.conf:

的upload_max_filesize
上载文件的最大尺寸。

upload_max_filesize
The maximum size of an uploaded file.

的post_max_size
设置允许后数据的最大尺寸。要上传大文件,该值必须大于upload_max_filesize。如果内存限制是由配置脚本中激活,memory_limit也会影响文件上传。

post_max_size
Sets maximum size of post data allowed. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading.

max_input_time设置
这台以秒为单位的脚本允许解析输入数据,如POST,GET和文件上传的最长时间。

max_input_time
This sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads.

PHP_INI_ALL:下面的设置可以在php.ini,htaccess的httpd.conf的设置,或与的 ini_set()

PHP_INI_ALL: The following settings can be set in php.ini, .htaccess, httpd.conf, or with ini_set():

<一个href="http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time">max_execution_time
这将设置在秒脚本允许运行之前它被分析器终止的最大时间。如果这个限度太低,你的脚本将终止大型文件有时间来之前上传

max_execution_time
This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. If this limit is too low, your script will terminate before a large file has had time to upload.

memory_limit的
本指令设定了一个脚本所能够申请到字节的内存的最高金额。如果内存限制是由配置脚本中激活,memory_limit也会影响文件上传。一般来说, memory_limit的应该比的post_max_size 大。

memory_limit
This sets the maximum amount of memory in bytes that a script is allowed to allocate. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

POST方法上传
当通过POST方法上传的文件,你还需要在你的HTML表单设置 MAX_FILE_SIZE 。有关详细信息,请参阅本:

POST upload method
When uploading files via the POST method, you also need to set MAX_FILE_SIZE in your HTML form. See this for more details:

<一个href="http://www.php.net/manual/en/features.file-upload.post-method.php">http://www.php.net/manual/en/features.file-upload.post-method.php

共享主机
如果您使用的是共享的主机,这是不可能的,你将能够访问系统的php.ini文件。但是,你可以在.htaccess或在每个目录php.ini文件中设置的值。一些共享主机提供商可以从这样$​​ P $ pvent你,所以你需要检查,如果是这种情况。

Shared hosting
If you are using shared hosting, it is unlikely that you will be able to access the system php.ini file. However, you can set the values in .htaccess or in a per-directory php.ini file. Some shared hosting providers may prevent you from doing this, so you will need to check if this is the case.

的.htaccess
下面是一个示例.htaccess文件:

.htaccess
Here's a sample .htaccess file:

<IfModule mod_php5.c>
  php_value upload_max_filesize 70M
  php_value post_max_size 80M
  php_value memory_limit 90M
  php_value max_execution_time 240
  php_value max_input_time 240
</IfModule>

每目录的php.ini
上面的设置也可以在每个目录的php.ini文件改变。再次,要做到这一点的能力可能会受到您的主机provder受到限制。有关更多信息,请参见这里:

Per-directory php.ini
The above settings can also be changed in a per-directory php.ini file. Again, the ability to do this may be restricted by your hosting provder. For more information on this, see here:

<一个href="http://www.askapache.com/php/custom-phpini-tips-and-tricks.html">http://www.askapache.com/php/custom-phpini-tips-and-tricks.html

可变:
有关PHP_INI_ *模式,这表明那里的配置指令可以设置的描述,在这里看到:
<一href="http://php.net/manual/en/configuration.changes.modes.php">http://php.net/manual/en/configuration.changes.modes.php

Changeable:
For a description of the PHP_INI_* modes, which show where configuration directives may be set, see here:
http://php.net/manual/en/configuration.changes.modes.php

这篇关于在Linux服务器上修改文件上传大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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