locked
can't run php website RRS feed

  • Question

  • User394746963 posted

    Hello,

    get in trouble with IIS configuration PHP. I can access the DefaultWebSite but I'm not able to run any other!

    here are ISS features

    features

     here is iis screenshot

    iis

    and Edge result. Nothing!

    edge

    what's the issue, please?

    Best Regards

    Tuesday, December 13, 2016 12:52 PM

Answers

  • User1896514328 posted

    Glad to hear it's working!

    Remember these main points regarding permissions:

    1. The application pool account must be able to access the content directories. This can be achieved by adding IIS_IUSRS local group with read/exec permissions.
    2. The end-user must have the necessary permissions as well. For scenarios where the actual end-user account gets used (Windows Auth, for example), then you must make sure those accounts have read/exec permissions on the content folders and files. When Anonymous Auth is used, there is no end-user account context. But, the server has to have a way to control anonymous access. This is where the anonymous auth account comes into play. By default, it's IUSR. You have to make sure that account also has permissions to the content and directories. This account can be changed as well.

    Good luck!

    EDIT: Also, be sure to mark Yuk's and my posts as the answers so the thread gets marked as "Answered." Thank you!

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, December 14, 2016 4:07 AM

All replies

  • User1896514328 posted

    Hi WhyDi,

    First off - PHP is installed, right? What version is being run? What instructions did you follow to install PHP? This is a good guide:
    https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php

    Is your PHP syntactically correct? Do any PHP pages work at all?

    Tuesday, December 13, 2016 1:30 PM
  • User394746963 posted

    Hi Mahamr,

    To be clear I'm trying to move from Webmatrix to VS code.

    So WebMatrix installed PHP 5.4. In other words Webmatrix run PHP websites with no issue.

    I didn't modify the installation. I just checked the features as shown above but no more then tested ../inetpub/wwwroot/iisstart.htm which is ok. I created ../inetpub/wwwroot/test.php <?PHP phpinfo(); ?> which is also OK but I can't go further!

    I would have liked making my websites at work modifying as less as I can the current install.

    may you lead me?

    checked php.ini :

    a. Set fastcgi.impersonate = 1

    b. Set cgi.fix_pathinfo=0. was 1. I replaced 0 with no change.

    c. Set cgi.force_redirect = 0.

    d. Set open_basedir is empty. Should I fill? my websites have différent paths!

    e. Set extension_dir OK

    f. Set error_log OK

    8.Path variable OK

    12. Double-click on the Handler Mappings icon. OK

    23. You should now see the PHP information page at http://localhost/phpinfo.php. OK

    Regards

    Tuesday, December 13, 2016 3:39 PM
  • User1896514328 posted

    So the phpinfo() page works correctly? If so, that means the PHP setup with IIS is correct and the issue is either with configuration that page specifically needs, or something the page is doing is failing.

    Could also have a look at this to see if there are any PHP errors, or look at the PHP errorlog as well:
    https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/improve-php-error-messages-in-iis-7-and-above

    Tuesday, December 13, 2016 5:15 PM
  • User394746963 posted

    phpInfo() works correctly.
    I have just given a trial to php 7.0.14 modifying mapping in iis manager with always the same result.


    I followed your link but no change and I can't see the IIS "not found" detailed message - Edge message only.


    What do you mean 'configuration that page specifically needs'. All pages of the website work with webmatrix and also on the web as you may see http://www.SUalive.com . no specific configuration as far as I know.
    may you tell me more?

    Tuesday, December 13, 2016 7:30 PM
  • User394746963 posted

    in addition I made the following test

    clear ../intepub/wwwroot/*.* then copy website into ../inet/wwwroot/

    1. url http://localhost/index.php returns

    website

    of course doesn't work any other location

    and http://localhost/ returns nothing. no message and blank page, no content.

    other way working

    create ../inetpub/SUalv directory then copy website into and add iis entry

    Edge address http://localhost:5657/index.ph returns

    http://localhost:5657/return blank page and the same out of ../inetpub directory

     

    I hope this helps you to get a better understanding...

    Wednesday, December 14, 2016 12:59 AM
  • User1896514328 posted

    Since phpinfo() works, IIS is properly configured to run PHP pages. If a page doesn't work, then something about that page is broken. Are there any events in the Windows Application event log?

    Wednesday, December 14, 2016 1:47 AM
  • User1896514328 posted

    On your site I see an HTTP 301 redirect from the site root to en_index.php. How is this redirect implemented? Is the IIS Default Document configured to run en_index.php or do you have some PHP code on an index.php that is supposed to redirect? Or something else?

    Wednesday, December 14, 2016 1:52 AM
  • User-460007017 posted

    Hi WhyDi,

    If you enable F12 developer tools in web browser, what's the status code?

    You didn't install HTTP error feature, so the web page will not return any error message. Please install the http error and enable the detailed error page In error pages->edit feature setting->detailed error. Then you can post the error message here.

    To prevent the static content didn't be loaded, please install the static content feature.

    Besides, if you want to enable http://localhost/ to show something, please enable the default document in Default document feature and move your page to the top of the order list.

    You website probably didn't enable the anonymous authentication, please make sure the anonymous authentication has been enabled.

    Best Regards,

    Yuk Ding

    Wednesday, December 14, 2016 2:00 AM
  • User394746963 posted

    Hi Yuk Ding,

    @Mahamar

    I'm going to reply in some time... before that have a look at the error I've got

    I installed HTTP error features but where is errorPages->editFeatureSettings->detailedErrors? I can't find!

    Nevertheless Edge tells me the following

    Translation may help

    Config Error. Can't read config file due to permissions

    I defined DefaultDocument feature adding index.php and no longer get empty page with url http://localhost:5657 which is working know but only from ../inetpub/...

    Regards

    Wednesday, December 14, 2016 2:47 AM
  • User394746963 posted

    after

    I get

    but permissions are right! what's going on?

    Wednesday, December 14, 2016 3:27 AM
  • User1896514328 posted

    Now that the app pool can read the folder (via IIS_IUSRS), you now need to allow the user account access. Since you are using Anonymous Authentication, by default that user is IUSR. So, give IUSR read/execute permissions.

    Wednesday, December 14, 2016 3:30 AM
  • User394746963 posted

    It works!

    You really are nice guys and I thank you a lot for the time and your skill as well.

    I would never have thought it was all about permission and didn't know nothing about IIS_IUSRS and IUSR. I wouldn't have been able to to make my websites at work out of your so great and so quick help!

    I would tell you some nice words to please you but get a bit tired and do not find anything appropriate. So once more. A thousand of thanks, really!

    Have a good week and have a good end of the year

    WhyDi

    Wednesday, December 14, 2016 3:54 AM
  • User1896514328 posted

    Glad to hear it's working!

    Remember these main points regarding permissions:

    1. The application pool account must be able to access the content directories. This can be achieved by adding IIS_IUSRS local group with read/exec permissions.
    2. The end-user must have the necessary permissions as well. For scenarios where the actual end-user account gets used (Windows Auth, for example), then you must make sure those accounts have read/exec permissions on the content folders and files. When Anonymous Auth is used, there is no end-user account context. But, the server has to have a way to control anonymous access. This is where the anonymous auth account comes into play. By default, it's IUSR. You have to make sure that account also has permissions to the content and directories. This account can be changed as well.

    Good luck!

    EDIT: Also, be sure to mark Yuk's and my posts as the answers so the thread gets marked as "Answered." Thank you!

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, December 14, 2016 4:07 AM