Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My goal is to increase the maximum file size for uploads in WordPress. I have followed the steps on this SE answer and this tutorial (except the .htaccess part, because it's runnning nginx and AFAIK nginx ignores .htaccess files), to no avail. Looks like it is ignoring php.ini files from the current folder.

On an unrelated WP install I run on a shared host I rent, if I place a php.ini file on the WordPress folder (or any folder), the parameters on that file will take precedence over the original php.ini folder, and the unspecified parameters will be inherited.

I assume this is default PHP behaviour. The beginning of /etc/php.ini seems to corroborate that:


; About php.ini   ;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.

; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)

; 4. Current working directory (except CLI)

; 5. The web server's directory (for SAPI modules), or directory of PHP
; (otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
; Windows directory (C:\windows or C:\winnt)
; See the PHP docs for more specific information.
; http://php.net/configuration.file

The official documentation also seems to agree:

In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the document root, only its directory is scanned.

In my instance, looks like it is not working; adding a php.ini or php5.ini file with upload_max_filesize, etc, won't have the desired effect. Adding @ini_set( 'upload_max_size' , '64M' ); to the end of WP's functions.php file, as advised elsewhere, won't work as well.

Output of php --ini:

Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/curl.ini,

From phpinfo():

Configuration File (php.ini) Path   /etc
Loaded Configuration File   /etc/php.ini
Scan this dir for additional .ini files     /etc/php.d
Additional .ini files parsed    /etc/php.d/curl.ini, /etc/php.d/dom.ini, /etc/php.d/fileinfo.ini, /etc/php.d/json.ini, /etc/php.d/mbstring.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/phar.ini, /etc/php.d/posix.ini, /etc/php.d/sqlite3.ini, /etc/php.d/sysvmsg.ini, /etc/php.d/sysvsem.ini, /etc/php.d/sysvshm.ini, /etc/php.d/wddx.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini, /etc/php.d/zip.ini 
  • OS: CentOS release 6.5 (Final) 2.6.32-431.17.1.el6.x86_64
  • PHP version: 5.4.30
  • Web Server: nginx-1.6.0-2.el6.ngx.x86_64
share|improve this question
Paste bin your /etc/php.ini and the contents of your nginx.conf file. –  mossy Jul 21 '14 at 22:43

1 Answer 1

With out seeing your config files, I can only assume..

Make sure that you have made the following changes to your nginx.conf file:

http {

client_max_body_size $New_File_Size;


Replace $New_File_Size to what you set your php.ini max file size to.

Once you have added this line to your existing nginx.conf file, you need to restart your services.

service php-fpm restart

service nginx reload

If this doesn't work, paste bin your config files and I will help you further.

You should also update your PHP version.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.