Question

Apache + mod_proxy_fcgi + php-fpm -> file uploads don't work in Wordpress w. mod_http2 enabled??

Hi all,

Why is it that file uploading in wordpress doesn’t work when I run PHP-FPM through mod-proxy-fcgi with mod_http2? As soon as I disable http2, it all works swimmingly and I can upload files with no issues.

Switching to mod-php also allows me to use http2, but that forces me ontp mpm-prefork and I’ve read there are stability issues when using mpm-prefork with http2.

Config below (from mod_info):

74: Mutex file:/var/lock/apache2 default
81: PidFile /var/run/apache2/apache2.pid
86: Timeout 300
92: KeepAlive On
99: MaxKeepAliveRequests 100
105: KeepAliveTimeout 5
109: User www-data
110: Group www-data
120: HostnameLookups Off
128: ErrorLog /var/log/apache2/error.log
137: LogLevel warn
In file: /etc/apache2/mods-enabled/alias.conf
14: Alias /icons/ "/usr/share/apache2/icons/"
16: <Directory "/usr/share/apache2/icons">
17: Options FollowSymlinks
18: AllowOverride None
19: Require all granted
: </Directory>
In file: /etc/apache2/mods-enabled/deflate.conf
4: AddOutputFilterByType DEFLATE text/html text/plain text/xml
7: AddOutputFilterByType DEFLATE text/css
8: AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
9: AddOutputFilterByType DEFLATE application/rss+xml
10: AddOutputFilterByType DEFLATE application/xml
In file: /etc/apache2/mods-enabled/dir.conf
2: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
In file: /etc/apache2/mods-enabled/http2.conf
2: Protocols h2 h2c http/1.1
In file: /etc/apache2/mods-enabled/info.conf
7: <Location /server-info>
8: SetHandler server-info
: </Location>
In file: /etc/apache2/mods-enabled/mime.conf
7: TypesConfig /etc/mime.types
27: AddType application/x-compress .Z
28: AddType application/x-gzip .gz .tgz
29: AddType application/x-bzip2 .bz2
69: AddLanguage am .amh
70: AddLanguage ar .ara
71: AddLanguage be .be
72: AddLanguage bg .bg
73: AddLanguage bn .bn
74: AddLanguage br .br
75: AddLanguage bs .bs
76: AddLanguage ca .ca
77: AddLanguage cs .cz .cs
78: AddLanguage cy .cy
79: AddLanguage da .dk
80: AddLanguage de .de
81: AddLanguage dz .dz
82: AddLanguage el .el
83: AddLanguage en .en
84: AddLanguage eo .eo
86: RemoveType es
87: AddLanguage es .es
88: AddLanguage et .et
89: AddLanguage eu .eu
90: AddLanguage fa .fa
91: AddLanguage fi .fi
92: AddLanguage fr .fr
93: AddLanguage ga .ga
94: AddLanguage gl .glg
95: AddLanguage gu .gu
96: AddLanguage he .he
97: AddLanguage hi .hi
98: AddLanguage hr .hr
99: AddLanguage hu .hu
100: AddLanguage hy .hy
101: AddLanguage id .id
102: AddLanguage is .is
103: AddLanguage it .it
104: AddLanguage ja .ja
105: AddLanguage ka .ka
106: AddLanguage kk .kk
107: AddLanguage km .km
108: AddLanguage kn .kn
109: AddLanguage ko .ko
110: AddLanguage ku .ku
111: AddLanguage lo .lo
112: AddLanguage lt .lt
113: AddLanguage ltz .ltz
114: AddLanguage lv .lv
115: AddLanguage mg .mg
116: AddLanguage mk .mk
117: AddLanguage ml .ml
118: AddLanguage mr .mr
119: AddLanguage ms .msa
120: AddLanguage nb .nob
121: AddLanguage ne .ne
122: AddLanguage nl .nl
123: AddLanguage nn .nn
124: AddLanguage no .no
125: AddLanguage pa .pa
126: AddLanguage pl .po
127: AddLanguage pt-BR .pt-br
128: AddLanguage pt .pt
129: AddLanguage ro .ro
130: AddLanguage ru .ru
131: AddLanguage sa .sa
132: AddLanguage se .se
133: AddLanguage si .si
134: AddLanguage sk .sk
135: AddLanguage sl .sl
136: AddLanguage sq .sq
137: AddLanguage sr .sr
138: AddLanguage sv .sv
139: AddLanguage ta .ta
140: AddLanguage te .te
141: AddLanguage th .th
142: AddLanguage tl .tl
143: RemoveType tr
145: AddLanguage tr .tr
146: AddLanguage uk .uk
147: AddLanguage ur .ur
148: AddLanguage vi .vi
149: AddLanguage wo .wo
150: AddLanguage xh .xh
151: AddLanguage zh-CN .zh-cn
152: AddLanguage zh-TW .zh-tw
161: AddCharset us-ascii .ascii .us-ascii
162: AddCharset ISO-8859-1 .iso8859-1 .latin1
163: AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
164: AddCharset ISO-8859-3 .iso8859-3 .latin3
165: AddCharset ISO-8859-4 .iso8859-4 .latin4
166: AddCharset ISO-8859-5 .iso8859-5 .cyr .iso-ru
167: AddCharset ISO-8859-6 .iso8859-6 .arb .arabic
168: AddCharset ISO-8859-7 .iso8859-7 .grk .greek
169: AddCharset ISO-8859-8 .iso8859-8 .heb .hebrew
170: AddCharset ISO-8859-9 .iso8859-9 .latin5 .trk
171: AddCharset ISO-8859-10 .iso8859-10 .latin6
172: AddCharset ISO-8859-13 .iso8859-13
173: AddCharset ISO-8859-14 .iso8859-14 .latin8
174: AddCharset ISO-8859-15 .iso8859-15 .latin9
175: AddCharset ISO-8859-16 .iso8859-16 .latin10
176: AddCharset ISO-2022-JP .iso2022-jp .jis
177: AddCharset ISO-2022-KR .iso2022-kr .kis
178: AddCharset ISO-2022-CN .iso2022-cn .cis
179: AddCharset Big5 .Big5 .big5 .b5
180: AddCharset cn-Big5 .cn-big5
182: AddCharset WINDOWS-1251 .cp-1251 .win-1251
183: AddCharset CP866 .cp866
184: AddCharset KOI8 .koi8
185: AddCharset KOI8-E .koi8-e
186: AddCharset KOI8-r .koi8-r .koi8-ru
187: AddCharset KOI8-U .koi8-u
188: AddCharset KOI8-ru .koi8-uk .ua
189: AddCharset ISO-10646-UCS-2 .ucs2
190: AddCharset ISO-10646-UCS-4 .ucs4
191: AddCharset UTF-7 .utf7
192: AddCharset UTF-8 .utf8
193: AddCharset UTF-16 .utf16
194: AddCharset UTF-16BE .utf16be
195: AddCharset UTF-16LE .utf16le
196: AddCharset UTF-32 .utf32
197: AddCharset UTF-32BE .utf32be
198: AddCharset UTF-32LE .utf32le
199: AddCharset euc-cn .euc-cn
200: AddCharset euc-gb .euc-gb
201: AddCharset euc-jp .euc-jp
202: AddCharset euc-kr .euc-kr
204: AddCharset EUC-TW .euc-tw
205: AddCharset gb2312 .gb2312 .gb
206: AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
207: AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
208: AddCharset shiftjis .shiftjis .sjis
209: AddCharset BRF .brf
236: AddHandler type-map var
244: AddType text/html .shtml
245: AddOutputFilter INCLUDES .shtml
In file: /etc/apache2/mods-enabled/mpmevent.conf
9: StartServers 5
10: MinSpareThreads 25
11: MaxSpareThreads 75
12: ThreadLimit 64
13: ThreadsPerChild 25
14: MaxRequestWorkers 150
15: MaxConnectionsPerChild 0
In file: /etc/apache2/mods-enabled/negotiation.conf
9: LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW
16: ForceLanguagePriority Prefer Fallback
In file: /etc/apache2/mods-enabled/setenvif.conf
7: BrowserMatch "Mozilla/2" nokeepalive
8: BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
9: BrowserMatch "RealPlayer 4.0" force-response-1.0
10: BrowserMatch "Java/1.0" force-response-1.0
11: BrowserMatch "JDK/1.0" force-response-1.0
20: BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
21: BrowserMatch "MS FrontPage" redirect-carefully
22: BrowserMatch "^WebDrive" redirect-carefully
23: BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
24: BrowserMatch "^gnome-vfs/1.0" redirect-carefully
25: BrowserMatch "^gvfs/1" redirect-carefully
26: BrowserMatch "^XML Spy" redirect-carefully
27: BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
28: BrowserMatch " Konqueror/4" redirect-carefully
In file: /etc/apache2/mods-enabled/ssl.conf
14: SSLRandomSeed startup builtin
15: SSLRandomSeed startup file:/dev/urandom 512
16: SSLRandomSeed connect builtin
17: SSLRandomSeed connect file:/dev/urandom 512
29: AddType application/x-x509-ca-cert .crt
30: AddType application/x-pkcs7-crl .crl
36: SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
43: SSLSessionCache shmcb:/var/run/apache2/sslscache(512000)
44: SSLSessionCacheTimeout 300
59: SSLCipherSuite HIGH:!aNULL
73: SSLProtocol all -SSLv3
In file: /etc/apache2/ports.conf
5: Listen 80
8: Listen 443
In file: /etc/apache2/apache2.conf
153: <Directory />
154: Options FollowSymLinks
155: AllowOverride None
156: Require all denied
: </Directory>
159: <Directory /usr/share>
160: AllowOverride None
161: Require all granted
: </Directory>
164: <Directory /var/www/>
165: Options Indexes FollowSymLinks
166: AllowOverride None
167: Require all granted
: </Directory>
183: AccessFileName .htaccess
189: <FilesMatch "^\.ht">
190: Require all denied
: </FilesMatch>
206: LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhostcombined
207: LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
208: LogFormat "%h %l %u %t \"%r\" %>s %O" common
209: LogFormat "%{Referer}i -> %U" referer
210: LogFormat "%{User-agent}i" agent
In file: /etc/apache2/conf-enabled/javascript-common.conf
1: Alias /javascript /usr/share/javascript/
3: <Directory "/usr/share/javascript/">
4: Options FollowSymLinks MultiViews
: </Directory>
In file: /etc/apache2/conf-enabled/other-vhosts-access-log.conf
2: CustomLog /var/log/apache2/othervhostsaccess.log vhostcombined
In file: /etc/apache2/conf-enabled/php7.0-fpm.conf
3: SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
5: <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
6: SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost"
: </FilesMatch>
8: <FilesMatch ".+\.phps$">
12: Require all denied
: </FilesMatch>
15: <FilesMatch "^\.ph(p[3457]?|t|tml|ps)$">
16: Require all denied
: </FilesMatch>

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

I just came across this question.

What I would usually do in such cases is to first check the Apache error log:

  1. sudo tail -100 /var/log/apache2/error.log

Also, try enabling the PHP error logging and check the PHP error log as well.

It is possible that the PHP-FPM user does not have the rights to write to the uploads directory. What you could do is set the PHP-FPM user to match the Apache user so that it could write to those folders.

Regards, Bobby