[英]upload_max_filesize changed in php.ini file, but ini_get still shows 2M
[英]php.ini max_upload_file size falling back to default 2M
我必須使用模塊“備份和遷移”在drupal-7中上載5.7MB數據庫。 但是,當我上傳文件時,它拋出以下錯誤:
The file email839805758.zip could not be saved, because it exceeds 2 MB, the maximum allowed size for uploads.
我已經更改了php.ini文件中的pload_max_filesize = 40M
post_max_size = 20M
和u pload_max_filesize = 40M
並在/etc/php/5.6/apache2/conf.d/user.ini中創建了user.ini
。 並粘貼大於2M的post_max_size和upload_max_filesize
。 我檢查了phpinfo()。 它只是將默認值設置為2M。 在drupal 7中,有人對這種場景有任何解決方案嗎?
我在drupal backup_migrate.module
文件中發現了一些其他東西,可能是障礙。 幫我破解這個功能。
/**
* A custom version of format size which treats 1GB as 1000 MB rather than 1024 MB
* This is a more standard and expected version for storage (as opposed to memory).
*/
function backup_migrate_format_size($size, $langcode = LANGUAGE_NONE) {
$precision = 2;
$multiply = pow(10, $precision);
if ($size == 0) {
return t('0 bytes', array(), array('langcode' => $langcode));
}
if ($size < 1024) {
return format_plural($size, '1 byte', '@count bytes', array(), array('langcode' => $langcode));
}
else {
$size = ceil($size * $multiply / 1024);
$string = '@size KB';
if ($size >= (1024 * $multiply)) {
$size = ceil($size / 1024);
$string = '@size MB';
}
if ($size >= 1000 * $multiply) {
$size = ceil($size / 1000);
$string = '@size GB';
}
if ($size >= 1000 * $multiply) {
$size = ceil($size / 1000);
$string = '@size TB';
}
return t($string, array('@size' => round($size/$multiply, $precision)), array('langcode' => $langcode));
}
}
在腳本中放入phpinfo(),然后查看所使用的php.ini文件。 進入該文件並更改這些值。 請記住,必須重新啟動守護程序(php-fpm或apache)才能激活更改。
如果由於某種原因不能執行此操作,強烈建議您在本地使用ini_set()函數!
使用phpinfo()檢查使用了什么php配置文件。 對我來說,您似乎編輯了錯誤的php.ini。 另外,不要忘記重新啟動Web服務器(Apache?)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.