Search code examples
phppostrequestwebserveriis-8

PHP - Large POST Request Server Error


For my Webserver I'm using IIS8 on a Windows Server 2012 with ASP.NET, PHP7+ and FastCGI.

My problem: When I try to submit a formular (HTML to PHP) with a value string, in thic case longer than 20.000 characters, the server returns a 500 Server Error OR it doesn't recognize the post request at all.

My HTML/PHP Code:

<?php if(isset($_POST['submit'])) { echo "Got it!"; } ?> 

<form action="" method="post">
<input type="text" value="String with 20000+ characters" name="value">
<input type="submit" name="submit">
</form>

By clicking submit the server error comes up. Within the post request these lines are inserted in the PHP Error Log File:

[] PHP Warning:  Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0
[] PHP Warning:  Unknown: POST data can't be buffered; all data discarded in Unknown on line 0

I also edited all configuration options that may be in connection with this.

php.ini

post_max_size = 1024M
memory_limit = 512M
upload_max_filesize = 1024M

web.config on my server

<system.web><httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
</system.web>

    <security>
<requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>

Thanks for any support.


Solution

  • In a terminal type :

    chmod -R 777 /your/upload/folder
    

    you can know the folder where your php uploads files by executing this code :

    $tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
    die($tmp_dir);
    

    In my case I get /var/... so when I sett 777 permission I get no error.