We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29387
    • 40 Posts
    My host upgraded my server this weekend from Apache 2.2.8 to 2.2.9 and from PHP 5.2.5 to 5.2.6.

    FeedX had been working fine before this, but now throws off a parse error:

    PHP error debug
    Error: fopen(mydomain/assets/cache/feedx/url_89a70593) [function.fopen]: failed to open stream: Permission denied
    Error type/ Nr.: Warning - 2
    File: mydomain/assets/snippets/FeedX/classes/feedx.class.inc.php
    Line: 300
    Line 300 source: $fh = fopen($file, ’w+’);

    Has anyone successfully run FeedX with Apache 2.2.9 and/or PHP 5.2.6?

    Any clues on how to fix FeedX for the newest environment?
      • 22303 MODX Staff
      • 10,725 Posts
      That is simply a permissions problem, as the error describes. The admins may have reset default permissions on your files during the upgrade. Is this FeedX instance pointing to an XML file on your local server?
        • 29387
        • 40 Posts
        FeedX is working again at the moment. There were 2 issues involved with this:

        1. fopen function had been disabled

        2. Ownership/permissions had to be reset, as you suggested.


        In reviewing this, however, I came across a couple of security concerns which might be of interest:

        a. For example, at http://phpsec.org/projects/phpsecinfo/tests/allow_url_fopen.html, they say enabling allow_url_fopen opens the server "to code injection vulnerabilities."

        b. Likewise, at http://wiki.dreamhost.com/index.php/Allow_url_fopen, they say that "Enabling allow_url_fopen is a terrible idea that exposes your website, and the websites of others on your shared server, to unnecessary risk."

        Does anyone have experience with this issue? Is this only a concern with user-supplied input? Is usage with RSS feeds OK then?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Here is a bit of code that works around that; I would imagine this would work for feeds as well.
          http://codex.gallery2.org/Gallery2:How_To_Use_The_External_Image_Block_When_url_fopen_Is_Disabled

          The problem is not in allowing url fopen as such, it’s with dumb users programming dumb stuff (as is so often the case, no?)
          The usual problem with allowing URLs in fopen and in "include" or "require"
          is that users do some stupid stuff like include($_GET['script'].'.php') and
          get a myriad of remote code executed on your server (usually used by
          spammers to send email using your server).
          

          This was a discussion on the problem of users coding with url fopen in such a way as to create an infinite loop, eventually overloading and crashing the entire server.
          http://marc.info/?t=119619812400005&r=1&w=2
          This source reccomends suhosin, which can be configured on a domain-by-domain basis.
          http://www.hardened-php.net/suhosin/

          There are some other solutions in the user comments here:
          http://www.php.net/manual/en/function.fopen.php
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 29387
            • 40 Posts
            OK, so if I understand correctly, the simple usage of fopen in FeedX is not a security problem. Thanks for your comments, Susan.