{"id":332,"date":"2017-06-01T21:11:58","date_gmt":"2017-06-01T21:11:58","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=332"},"modified":"2017-06-01T22:47:38","modified_gmt":"2017-06-01T22:47:38","slug":"backend-log-php-warning-file-upload-error-unable-to-create-a-temporary-file-in-unknown-on-line-0","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/backend-log-php-warning-file-upload-error-unable-to-create-a-temporary-file-in-unknown-on-line-0.html","title":{"rendered":"Backend log: PHP Warning:  File upload error &#8211; unable to create a temporary file in Unknown on line 0"},"content":{"rendered":"<p>It is a common php error appears when PHP handler unable to detect the server temporary folder automatically. A solution to the problem is to define the upload_tmp_dir of the php explicitly. You can do that by editing the php.ini file. Here is an example on how to do it:<\/p>\n<p>To find the running php.ini file, use phpinfo:<\/p>\n<blockquote><p>root@chicago1 [~]# php -r &#8216;phpinfo();&#8217;|grep php.ini<br \/>\nConfiguration File (php.ini) Path =&gt; \/opt\/cpanel\/ea-php56\/root\/etc<br \/>\nLoaded Configuration File =&gt; \/opt\/cpanel\/ea-php56\/root\/etc\/php.ini<\/p><\/blockquote>\n<p>As the command suggests, your php.ini file is located under the following:<\/p>\n<blockquote><p>\/opt\/cpanel\/ea-php56\/root\/etc\/php.ini<\/p><\/blockquote>\n<p>Now, edit the file using your favorite editor:<br \/>\n<code>nano\u00a0\/opt\/cpanel\/ea-php56\/root\/etc\/php.ini<\/code><br \/>\nFind the location of upload_tmp_dir, which is usually commented out like the following:<\/p>\n<blockquote><p>;upload_tmp_dir =<\/p><\/blockquote>\n<p>Uncomment it by removing the semicolon from front and define the temporary directory location:<\/p>\n<blockquote><p>upload_tmp_dir = \/tmp<\/p><\/blockquote>\n<p>Restart your apache.<\/p>\n<p>There is another way you can do it. To do this, go to WHM &gt;&gt; MultiPHP INI Editor &gt;&gt; Editor Mode &gt;&gt; Find upload_tmp_dir and edit it accordingly.<\/p>\n<p>This would create a user.ini file to be included with the original php.ini file.<\/p>\n<p>If none of the above solution works for you, you are probably seeing the error from modsecurity, try following the following steps to see if that overcomes the error:<\/p>\n<blockquote data-secret=\"UMk2oAevfZ\" class=\"wp-embedded-content\"><p><a href=\"https:\/\/mellowhost.com\/blog\/modsecurity-multipart-parsing-error-multipart-failed-to-create-file-roottmp20170526-122120-wsfjyo2khtvez5johzf8uqaaaew-file-9mmg15.html\">ModSecurity: Multipart parsing error: Multipart: Failed to create file: \/root\/tmp\/20170526-122120-WSfJYO2KhTvEz5johZF8UQAAAEw-file-9mmG15<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"https:\/\/mellowhost.com\/blog\/modsecurity-multipart-parsing-error-multipart-failed-to-create-file-roottmp20170526-122120-wsfjyo2khtvez5johzf8uqaaaew-file-9mmg15.html\/embed#?secret=UMk2oAevfZ\" data-secret=\"UMk2oAevfZ\" width=\"600\" height=\"338\" title=\"&#8220;ModSecurity: Multipart parsing error: Multipart: Failed to create file: \/root\/tmp\/20170526-122120-WSfJYO2KhTvEz5johZF8UQAAAEw-file-9mmG15&#8221; &#8212; Mellowhost Blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is a common php error appears when PHP handler unable to detect the server temporary folder automatically. A solution to the problem is to define the upload_tmp_dir of the php explicitly. You can do that by editing the php.ini file. Here is an example on how to do it: To find the running php.ini &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/backend-log-php-warning-file-upload-error-unable-to-create-a-temporary-file-in-unknown-on-line-0.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Backend log: PHP Warning:  File upload error &#8211; unable to create a temporary file in Unknown on line 0&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,11,12,25,26],"tags":[],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/332"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=332"}],"version-history":[{"count":3,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/332\/revisions"}],"predecessor-version":[{"id":335,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/332\/revisions\/335"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}