Errors accessing php codes [Answered]RSS

6 replies

Last post Sep 01, 2016 06:55 PM by Tewhano

  • Errors accessing php codes

    Aug 27, 2016 05:21 PM|Tewhano|LINK

    I have MS Server 2012 R2 with IIS 8 and PHP 7.0.10 installed (all 64-bit). I set this up a couple months ago and it was working fine. I have been working with the files on another PC for this project but I have not installed any yet. When I tried to access it a couple days ago for some reason it simply stopped working; returning the “HTTP Error 500.0 – Internal Server Error”. I deleted the PHP folder and installed PHP again. Now I get two different errors depending on the site I access. My site is situated on the C: drive with two subfolders (Jokes, Contact) as such:

    C:\testsite

    ……….Jokes

    ……….Contact

    Jokes has the file ‘Index.php’ whereas Contact has the file ‘Index.html’ which calls the ‘contactforms.php’ within the code. Jokes returns the “403 – Forbidden: access is denied” error message but Contact returns the ‘webpage cannot be found’ error within the container where the form should be even though the HTML/CSS content is displayed properly. The file ‘contactforms.php’ is located in the same folder as the file ‘Index’html’ that calls it.

    This looks like a permissions issue but I didn’t change the permissions in either folder when I re-installed PHP. I am guessing that since I didn’t change anything when it stopped working that an update must have changed something. While I know this isn’t enough information to help me solve the issue I would appreciate guidance in where I should start looking for the problem. Of course I am more than happy to provide any information should someone want to tackle this issue.

  • Re: Errors accessing php codes

    Aug 29, 2016 03:03 AM|Jean Sun|LINK

    Hi Tewhano,

    Jokes returns the “403 – Forbidden: access is denied” error message 

    The 403 error is the permission error, please check the AppPool Identity's permission, make sure it has read/write permission to the site's folders. Or you can change the AppPool Identity to an admin account.

    Contact returns the ‘webpage cannot be found’ 

    The not found error means that the request file or folder not exist. Please check the ‘contactforms.php’ path is correct in ‘Index.html’.

    On the other hand, you can use failed request tracing to get detailed information about this issue.

    http://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Errors accessing php codes

    Aug 29, 2016 01:43 PM|Tewhano|LINK

    Thank you for your reply. I have been out of the loop for over 5 years and confess I knew nothing about the AppPool Identity needing access. I thought that was an automatic process that happened when you selected the DefaultAppPool to the Application Pool. This appears to have worked since I now get an error about the script (another issue I need to look into). I now wonder why it was working before and if I changed something that made it stop. I know I didn’t give DefaultAppPool access because I knew nothing about that.

    I cannot see where the error is with the ‘Contact” site. The ‘contactform.php’ file is in the same folder as the ‘index.html’ file and the entry to call the PHP file is this:

    <iframe src='contactform.php' frameborder='0' width='100%' height='600' allowtransparency='true'></iframe>

    I will look into the fail request tracing article you linked to and see what that says. Again thank you for your assistance.

  • Re: Errors accessing php codes

    Aug 30, 2016 05:37 AM|Jean Sun|LINK

    Hi Tewhano,

    You can learn more about the Apppool identity in the following link.

    http://www.iis.net/learn/manage/configuring-security/application-pool-identities

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Errors accessing php codes

    Aug 30, 2016 01:22 PM|Tewhano|LINK

    Thank you, I found that yesterday after your response and have printed that out as well as the Failed Request article and will read through them today and see if I can find out what is causing the issues. I am at a lost as to what I might have changed as I do not remember changing anything since I had it working several weeks ago. The only thing I can think of is Microsoft updates may have added something into the mix. I might have to uninstall IIS and PHP and start over to fix this issue.

  • Re: Errors accessing php codes

    Sep 01, 2016 03:54 PM|Tewhano|LINK

    I activated the failed request tracing but I must confess the huge output is mostly useless to me since I really do not understand it. I did find an entry that looks odd to me. For the most part it looks as if the file ‘contactform.php’ was found but the FastCGI failed.

    42. HANDLER_PRECONDITION_NOT_MATCH Name="ExtensionlessUrlHandler-ISAPI-4.0_32bit", Precondition="classicMode,runtimeVersionv4.0,bitness32" 14:12:02.589 
    43. HANDLER_PRECONDITION_NOT_MATCH Name="ExtensionlessUrlHandler-ISAPI-4.0_64bit", Precondition="classicMode,runtimeVersionv4.0,bitness64" 14:12:02.589 
    44. GENERAL_GET_URL_METADATA PhysicalPath="", AccessPerms="513" 14:12:02.589 
    45. HANDLER_CHANGED OldHandlerName="", NewHandlerName="PHP_via_FastCGI1", NewHandlerModules="FastCgiModule", NewHandlerScriptProcessor="C:\PHP\php-cgi.exe", NewHandlerType="" 14:12:02.589

    There are four FastCGI entries in Handler Mappings:

    PHP_via_FastCGI

    PHP_via_FastCGI1

    PHP53_via_FastCGI

    PHP_via_FastCGI

     

    All these point to the same executable at C:\PHP\php-cgi.exe

    The part I find odd is line 99 where it assigns the HeaderValue to “PHP/7.0.10” because that folder does not exist.

    97. FASTCGI_START  14:12:02.605 
    98. FASTCGI_WAITING_FOR_RESPONSE  14:12:02.605 
    99. GENERAL_SET_RESPONSE_HEADER HeaderName="X-Powered-By", HeaderValue="PHP/7.0.10", Replace="false" 14:12:02.605 
    100. GENERAL_SET_RESPONSE_HEADER HeaderName="Content-type", HeaderValue="text/html; charset=UTF-8", Replace="false" 14:12:02.605 
    101. MODULE_INFORMATION ModuleName="FastCgiModule", Data1="FASTCGI_SETSTATUS", Data2="404 Not Found", ErrorCode="The operation completed successfully.
     (0x0)" 14:12:02.605 
    102. MODULE_SET_RESPONSE_ERROR_STATUS 
    Warning
    ModuleName="FastCgiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="404", HttpReason="Not Found", HttpSubStatus="0", ErrorCode="The operation completed successfully.
     (0x0)", ConfigExceptionInfo="" 14:12:02.605 
    103. FASTCGI_END  14:12:02.605

    I looked through the PHP.ini file and cannot find this value there. It correctly list the path as “C:\PHP”. Could this be the issue I am having?

  • Re: Errors accessing php codes

    Sep 01, 2016 06:55 PM|Tewhano|LINK

    That was the problem. The incorrect path was enter in the system PATH variable. Apparently when I updated the files to the 64bit version I entered the wrong path. I don’t remember doing that but since I am the only one that has access to my server I must have. Thanks for the help Jean.