From prabu_subroto@yahoo.com Mon Mar 24 11:34:59 2003 From: Prabu Subroto To: programming@lists.opensuse.org Subject: Web hit counter program with PHP Date: Mon, 24 Mar 2003 03:34:52 -0800 Message-ID: <20030324113452.68058.qmail@web20712.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1979125287096876130==" --===============1979125287096876130== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Dear my friends... I am writing a program to count how many time my homepage has been visited with PHP. The algorithm is: " if the visitor doesn't have the cookies, that means he/she just visited my homepage after the last time he/she close his/her internet browser. So I open my file which located in the directory of my homepage to read and increased the value inside it once. " I am using SuSE Linux 8.1 and PHP 4.2.2. But I'm stucked with these error message: " Warning: fopen("ngitung.txt", "w") - Permission denied in /srv/www/htdocs/iamsoft/isimuka.php on line 9 Warning: fwrite(): supplied argument is not a valid File-Handle resource in /srv/www/htdocs/iamsoft/isimuka.php on line 10 Warning: fclose(): supplied argument is not a valid File-Handle resource in /srv/www/htdocs/iamsoft/isimuka.php on line 11 Warning: fopen("ngitung.txt", "r") - No such file or directory in /srv/www/htdocs/iamsoft/isimuka.php on line 13 Warning: fread(): supplied argument is not a valid File-Handle resource in /srv/www/htdocs/iamsoft/isimuka.php on line 14 Warning: fclose(): supplied argument is not a valid File-Handle resource in /srv/www/htdocs/iamsoft/isimuka.php on line 16 Warning: fopen("ngitung.txt", "w") - Permission denied in /srv/www/htdocs/iamsoft/isimuka.php on line 18 Warning: fwrite(): supplied argument is not a valid File-Handle resource in /srv/www/htdocs/iamsoft/isimuka.php on line 19 Warning: fclose(): supplied argument is not a valid File-Handle resource " Any body would be so nice to help me? Please tell me what should I do. Here is my code: "



Under construction for "i(a)m"

Best viewed with : Mozilla and Konqueror Browsers. Resolutions : 1024 x 728.
Please enable cookies, JavaScript and JavaApplet on your browser.



" Thank you very much in advance. __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com --===============1979125287096876130==-- From gfeldman@attbi.com Mon Mar 24 11:52:46 2003 From: Jerry Feldman To: programming@lists.opensuse.org Subject: Re: [suse-programming-e] Web hit counter program with PHP Date: Mon, 24 Mar 2003 06:52:38 -0500 Message-ID: <20030324065238.73f72343.gfeldman@attbi.com> In-Reply-To: <20030324113452.68058.qmail@web20712.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0728698509395696739==" --===============0728698509395696739== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Mon, 24 Mar 2003 03:34:52 -0800 (PST) Prabu Subroto wrote: > Dear my friends... > > I am writing a program to count how many time my > homepage has been visited with PHP. The algorithm is: > " > if the visitor doesn't have the cookies, that means > he/she just visited my homepage after the last time > he/she close his/her internet browser. So I open my > file which located in the directory of my homepage to > read and increased the value inside it once. > " > > I am using SuSE Linux 8.1 and PHP 4.2.2. > > But I'm stucked with these error message: > " > Warning: fopen("ngitung.txt", "w") - Permission denied > in /srv/www/htdocs/iamsoft/isimuka.php on line 9 This appears to be the root of all your problems. You web server does not have write priviledge in the current directory, so ngitung.txt does not get written on the server. I might suggest you either make the directory writable, or (better) put ngitung.txt in another directory that is writable. You could set up a symlink to that directory so that so you don't have to change your code. (eg. set up the symlink to /tmp/ngitung.txt). -- -- Gerald Feldman Boston Computer Solutions and Consulting ICQ#156300 PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9 --===============0728698509395696739==-- From prabu_subroto@yahoo.com Mon Mar 24 12:24:27 2003 From: Prabu Subroto To: programming@lists.opensuse.org Subject: Re: [suse-programming-e] Web hit counter program with PHP Date: Mon, 24 Mar 2003 04:24:24 -0800 Message-ID: <20030324122424.92428.qmail@web20714.mail.yahoo.com> In-Reply-To: <20030324065238.73f72343.gfeldman@attbi.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6030468178190090206==" --===============6030468178190090206== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Dear Jerry... Firstly, thank you for your help. There are some things that I have not understood. 1. If I want to make my web server (Apache) may write into "/srv/www/htdocs/iamsoft/ngitung.txt", how should I do that? 2. If I want to make a writable directory, how should I do that? 3. If I can also use symlink, how should I do that? Is it somewhat like "ln -s"? I am looking forward to your further explanation, thank you very much in advance.... --- Jerry Feldman wrote: > On Mon, 24 Mar 2003 03:34:52 -0800 (PST) > Prabu Subroto wrote: > > > Dear my friends... > > > > I am writing a program to count how many time my > > homepage has been visited with PHP. The algorithm > is: > > " > > if the visitor doesn't have the cookies, that > means > > he/she just visited my homepage after the last > time > > he/she close his/her internet browser. So I open > my > > file which located in the directory of my homepage > to > > read and increased the value inside it once. > > " > > > > I am using SuSE Linux 8.1 and PHP 4.2.2. > > > > But I'm stucked with these error message: > > " > > Warning: fopen("ngitung.txt", "w") - Permission > denied > > in /srv/www/htdocs/iamsoft/isimuka.php on line 9 > This appears to be the root of all your problems. > You web server does > not have write priviledge in the current directory, > so ngitung.txt does > not get written on the server. I might suggest you > either make the > directory writable, or (better) put ngitung.txt in > another directory > that is writable. You could set up a symlink to that > directory so that > so you don't have to change your code. (eg. set up > the symlink to > /tmp/ngitung.txt). > > -- > -- > Gerald Feldman > Boston Computer Solutions and Consulting > ICQ#156300 PGP key id:C5061EA9 > PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 > FB00 3ED5 C506 1EA9 > > -- > To unsubscribe, email: > suse-programming-e-unsubscribe(a)suse.com > For additional commands, email: > suse-programming-e-help(a)suse.com > Archives can be found at: > http://lists/archive/suse-programming-e > __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com --===============6030468178190090206==-- From gfeldman@attbi.com Mon Mar 24 18:17:56 2003 From: Jerry Feldman To: programming@lists.opensuse.org Subject: Re: [suse-programming-e] Web hit counter program with PHP Date: Mon, 24 Mar 2003 13:17:53 -0500 Message-ID: <20030324131753.66723b46.gfeldman@attbi.com> In-Reply-To: <20030324122424.92428.qmail@web20714.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4442105045210204016==" --===============4442105045210204016== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Mon, 24 Mar 2003 04:24:24 -0800 (PST) Prabu Subroto wrote: > Dear Jerry... > > Firstly, thank you for your help. > > There are some things that I have not understood. > > 1. If I want to make my web server (Apache) may write > into "/srv/www/htdocs/iamsoft/ngitung.txt", how should > I do that? Make the iamsoft directory writable. But be very careful since by making it writable you open it up to a multitude of security risks. > 2. If I want to make a writable directory, how should > I do that? use the chmod command (eg. chmod o+w directory). I'm not going to go into the details. I suggest that you do not make your main document directories writable for security issues, which is why I suggested a symlink. > 3. If I can also use symlink, how should I do that? Is > it somewhat like "ln -s"? ln -s /tmp/ngitung.txt /srv/www/htdocs/iamsoft/ You need to have permission in /srv/www/htdocs/iamsoft/ to set the link (eg. become root). Note that Apache should be running as the "nobody" user. --===============4442105045210204016==--