Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Possible permissions issue with PHP file on IIS

  • 05-04-2009 08:55PM
    #1
    Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭


    Hi guys,
    I'm not too much in the know about IIS hosting and .NET stuff so I'm struggling with a little issue I have. My server supports PHP and I have uploaded the following file and a blank output.xml file:
    [PHP]
    <?php
    $url = "http://www.website.org/directory/rss?s=676&u=g225";
    $data = file_get_contents($url);
    $file = fopen("output.xml", "w+");
    fputs($file, $data);
    fclose($file);
    ?>
    [/PHP]

    The script is basically taking the contents of $url and puts it into a file called output.xml. When I run the PHP file, nothing happens. The .XML file doesn't update. I have logged onto my control panel and I have ticked all the boxes for permissions for both the PHP file and the output.xml.

    I'm thinking either I haven't correctly set the permissions or the "w+" statement is incorrect here: $file = fopen("output.xml", "w+");

    Any ideas? Thanks.


Comments

  • Closed Accounts Posts: 198 ✭✭sh_o


    If you try the following you can confirm if it is a permissions issue or otherwise....
    <?php 
    $data = "blah";
    $file = fopen("output.xml", "w+"); 
    fputs($file, $data); 
    fclose($file); 
    ?>
    


  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    Hi sh_o,
    I made those changes but nothing happened.


  • Moderators, Politics Moderators, Paid Member Posts: 44,038 Mod ✭✭✭✭Seth Brundle


    does phpinfo work?


  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    kbannon wrote: »
    does phpinfo work?
    Yup, it works.


  • Closed Accounts Posts: 198 ✭✭sh_o


    did you set the permissions for the user that runs the iis server:
    http://coppermine-gallery.net/tutorial/permissions/iis.php


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Most hosts have the "allow_url_fopen" option disabled in their PHP installs, and this prevents you from using the fopen() function to get the contents of web files.

    Have a look at the cURL library instead. It's a little more work than fopen() but much more powerful.


Advertisement