Changing File Permission on Web Server

My “Current Online Users” counter was working fine until I switched webhosts.

I remembered clearly I needed to change the permission of the text file on the server before it could work for I was not using SQL database. However, no matter what I tried, even to the extent of changing the permission for the folder, the counter refused to work.

I asked around my friends but none of the programmers was familiar with writing and reading a text file using PHP. I tried to google for solutions but it did not help, until I found on “www.php.net/fwrite” the line “PHP does not recognise the permissions setting for the file until you restart the server”. It stunned me for quite a moment. I was not using a dedicated server and I was not running the website on my personal server or computer, and it would be troublesome to get the server reset; moreover, I could not confirm it would work.

It actually took me a few days from assuming the servers were problematic to suspecting my FTP application was buggy, and finally to the urge to try debugging. My knowledge of the script was too shallow to spot any problem; moreover, I supposed there could not be a mistake since I had been using the same script for years. I started by adding codes into the different files for prompting. The last thing I did was to do a trial and error to remove a space/tab between a “3” and “000”, which aroused my suspicious. It finally worked.

I concluded that changing file permission was an immediate effect, which did not require restarting of the server. However, it might not always be the case for some extremely lousy servers that could or could not have existed.

.

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

This site uses Akismet to reduce spam. Learn how your comment data is processed.