PHP Dynamically Writing to iirf.ini file

Topics: Developer Forum, User Forum
Mar 26, 2010 at 2:50 AM
Edited Mar 26, 2010 at 2:51 AM

Hi there   :o)

I have a problem in that I'm using PHP to dynamically write rules to the end of the iirf.ini file. This is being done and works fine except that the rules aren't being executed. The appended text is in the file and is a VERY simple rewrite rule (one on each line):

     RewriteRule ^/uniquefilename.php /page-builder.php?id=uniquefilename

It's only after I download the file to computer, open it in a text editor, press "Save" and then upload it back does it then miraculously work!

Absolutely no changes to the actual contents of the INI file are made....

I've already tried opening the file's contents in PHP, deleting the file, creating a new file and appending the contents in to it - again all in PHP - and it still had no effect!

Any ideas how to get around this????

Cheers,
Richard

Coordinator
Mar 26, 2010 at 7:50 AM
Edited Mar 30, 2010 at 1:06 AM

What you describe should work. I don't know what the problem would be, but maybe we can figure it out.

You didn't mention the version of IIRF you're using.  If you've got v2.x, then the way it works is this:

IIRF checks the last modified timestamp of the ini file each time it receives a request, using the Win32 function, GetFileTime.  If you modify the file in any way, that timestamp will be updated, and IIRF will reload the ini file.

If this isn't working then one of the assumptions is bad.  Some possibilities:

  • the ini file isn't stored on an NTFS volume. It's stored in some other filesystem, a virtual filesystem, something like that.
  • your PHP app isn't closing the file, so that the changes are committed, and the timstamp never changes.
  • something else I haven't thought of.

I suggest you try a touch utility, to check whether it's operating correctly. you shouldn't need to copy or download the file anywhere, and re-copy it.  you just need to update it.

Something I don't understand - why are you downloading the file, anyway? Do you not have access to the server?

Mar 28, 2010 at 11:11 PM
Hi Cheeso,
This is just stupid.
Came in this morning and now everything works smoothly and fine...
No explanation - didn't change anything....
Thanks for your help anyway.
Richard :o)

From: Cheeso
Sent: Friday, March 26, 2010 5:50 PM
Subject: Re: PHP Dynamically Writing to iirf.ini file [IIRF:207365]

From: Cheeso

What you describe should work. I don't know what the problem would be, but maybe we can figure it out.

You didn't mention the version of IIRF you're using. If you've got v2.x, then the way it works is this:

IIRF checks the last modified timestamp of the ini file each time it receivevs a request, using the Win32 function, GetFileTime. If you modify the file in any way, that timestamp will be updated, and IIRF will reload the ini file.

If this isn't working then one of the assumptions is bad. Some possibilities:

  • the ini file isn't stored on an NTFS volume. It's stored in some other filesystem, a virtual filesystem, something like that.
  • your PHP app isn't closing the file, so that the changes are committed, and the timstamp never changes.
  • something else I haven't thought of.

I suggest you try a touch utility, to check whether it's operating correctly. you shouldn't need to copy or download the file anywhere, and re-copy it. you just need to update it.

Something I don't understand - why are you downloading the file, anyway? Do you not have access to the server?

Coordinator
Mar 30, 2010 at 1:06 AM

Gremlins :)