PHP Configuration Issue [Answered]RSS

4 replies

Last post Jun 11, 2013 06:53 PM by szarkos

  • PHP Configuration Issue

    Jun 06, 2013 05:55 AM|scottlpool2003|LINK

    This is a followon from the following thread: http://forums.iis.net/t/1198958.aspx/1?Troubleshooting+500+Error

    It is a file upload script and the URL is valid on the server. I've been trying for weeks to resolve this issue and nobody seems to be able to help me locate the problem.

    A more detailed description of the problem:

    Uploading files larger than 10MB nearly always fail but occasionally they get through. I believe the php.ini file to be setup correctly with the following settings:

    file_uploads On
    max_execution_time 1000
    max_file_uploads 20
    max_input_time 800
    memory_limit 128M
    post_max_size 70M
    upload_max_filesize 50M
    upload_tmp_dir C:\Temp\

    C:\Temp\ is writable.

    I have tried various scripts and all have the same outcome so I don't believe it to be a coding error. I see the file upload to C:\Temp and when it fails the file remains so it's almost like it just doesn't want to move the file. As I say, occasionally the file gets through and files less than 10MB get through fine so it is unlikely to be a permission issue.

    I also changed maxAllowedContentLength in IIS to 30000000 with no success.

    I then created an uploader in ASP which worked fine so this indicates its definitely a PHP issue.

    I am totally lost with this one and nobody seems to be able to help me get the issue resolved.

  • Re: PHP Configuration Issue

    Jun 06, 2013 10:45 AM|Rick Barber|LINK

    This forum is primarily for IIS questions and answers.  You will find that a lot of the people in the community who help answer questions here are more intimately familiar with ASP and ASP.Net and not as much with PHP.  Since you have narrowed this down to a PHP issue, I would recommend checking out the resources on the PHP site:  http://php.net/support.php.  At that link you will notice there is a newsgroup where I suspect you will find some PHP experts and have a better chance of getting your issue resolved.

    Rick Barber

    OrcsWeb: Managed Windows Hosting Solutions
    "Remarkable Service. Remarkable Support."
    IIS Community Newsletter
  • Re: PHP Configuration Issue

    Jun 06, 2013 11:47 AM|scottlpool2003|LINK

    That's:

    • DigitalPoint
    • SitePoint
    • PHP Help
    • Warrior Forum
    • WebHostingTalk
    • Parallels
    • Fasthosts

    And now IIS off the list.

    Cry 

    <?php
    
    $item1= "Brain";
    $item2= "Server";
    var_dump( explode( ',', $item1) );
    var_dump( explode( ',', $item2 ) );
    
    ?>

    I shall try the PHP site... probably with no luck. Thanks anyway.

  • Re: PHP Configuration Issue

    Jun 11, 2013 02:52 AM|kctt|LINK

    Have you tried uploading from within the server? Could it be slow internet speed causing upload error?

    Do you have to use PHP or you open to Asp / Asp.net upload script?

  • Re: PHP Configuration Issue

    Jun 11, 2013 06:53 PM|szarkos|LINK

    This sounds like it could be an execution timeout issue.  Can you check how long it takes from when you access the page (or click "submit" or whatnot) to when you receive the 500 error.  If the timing is consistent that usually suggests a timeout issue.

    I would recommend checking the following:

    • I see that you have set PHP's max_execution_time, post_max_size and memory_limit parameters.  These are the correct settings to check, and their settings look OK to me.  Can you also double-check that the php.ini file is being read properly?  An easy way to do this is to create a simple php script that looks like the following somewhere in your web root (perhaps call it phpinfo.php or something):

      <?php  phpinfo();  ?>

      Then request that file from your browser.  In the output of phpinfo you will see a parameter called "Loaded Configuration File".  This will point to the php.ini file currently used by IIS.  The phpinfo output will also contain all the parameters you set in your php.ini, so you can then search through this file and ensure that the above parameters are also set to your new values.  Good to check these too since unless you're running with startup_errors enabled you may not see warnings related to invalid parameters or typos.

      Also, to be safe, be sure to move or remove that phpinfo file before going to production.

    • Next, check your FastCGI Settings in IIS manager.  In the FastCGI Settings, click on the appropriate PHP entry and then click "Edit".  Then scroll down to "Request Timeout".  This is set to 90 seconds by default, but if your uploads sometimes take longer then you will see an error.  Change this to a higher value and then restart IIS.

    IIS has other timeouts as well (such as ConnectionTimeout which is set to 120 seconds by default), but if your uploads work with ASP and not with PHP that seems less likely to be the issue.

    Steve