Search code examples
codeigniterxamppsimplepie

Write permissions with Codeigniter + Simplepie


I am trying to create a simple RSS parser using the two frameworks. However I am getting PHPerrors when trying to write to my cache directory:

set_cache_location(APPPATH.'cache/rss');

I am running windows 7 with XAMPP using the latest version of Simplepie from github

error:

A PHP Error was encountered

Severity: User Warning

Message: C:\xampp\htdocs\geekurls/system/application/cache/rss is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.

Filename: libraries/simplepie.php

Line Number: 1732

Tried like the below comment said and tried making a test file but to no luck

        $file = APPPATH."cache/rss/testFile.txt";
        $handle = fopen($file, 'w') or die("fail");
        fclose($handle);

Solution

  • A simple checks to find out what might be happening,

    Try creating a file in this directory using standard php - this could help solve permission problems.

    $this->load->helper('file'); 
    
    $data = 'Some file data';
    
    if ( ! write_file('./path/to/file.php', $data))
    {
         echo 'Unable to write the file';
    }
    else
    {
         echo 'File written!';
    }
    

    Also how about using the default cache?

    http://simplepie.org/wiki/faq/i_m_getting_cache_error_messages