Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]Problem z funkcją fopen, Na jedym serwerze działa, na innym nie.
-sapper-
post 5.11.2007, 12:41:59
Post #1





Goście







Witam. Chodzi o banalnie prosty licznik, ale jestem początkujący i nie bardzo rozumiem, dlaczego wyrzuca mi takie błędy na serwerze na którym jest włączona obsługa PHP:

Warning: fopen(licznik.txt) [function.fopen]: failed to open stream: Permission denied in /usr/local/www/data/virtual/band.pl/magicmushroom/htdocs/index.php on line 40

Warning: fputs(): supplied argument is not a valid stream resource in /usr/local/www/data/virtual/band.pl/magicmushroom/htdocs/index.php on line 41

Warning: fclose(): supplied argument is not a valid stream resource in /usr/local/www/data/virtual/band.pl/magicmushroom/htdocs/index.php on line 42

Oto kod:
  1. <?
  2. $tab=file("licznik.txt");
  3. $ile=$tab[0]+1;
  4. echo "Odwiedziło nas $ile osób/y";
  5. $f = fopen("licznik.txt", "w");
  6. fputs($f,$ile);
  7. fclose($f);
  8. ?>
Powód edycji: dodalem tag (cysiaczek)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
zakręcony
post 5.11.2007, 13:16:53
Post #2





Grupa: Zarejestrowani
Postów: 107
Pomógł: 10
Dołączył: 26.09.2007

Ostrzeżenie: (0%)
-----


no jak myslisz?
podpowiedź 1:
Permission denied

podpowiedź 2a:
prawa dostepu

podpowiedź 2b:
chmod


--------------------
Rachunkowość w biurze we Wrocławiu: biuro rachunkowe wrocław, miejca parkingowe przy Okęciu parking Okecie.
Go to the top of the page
+Quote Post
-sapper-
post 5.11.2007, 13:23:01
Post #3





Goście







Wybacz, ale nic mi to nie mówi... =/
Go to the top of the page
+Quote Post
phpion
post 5.11.2007, 13:28:41
Post #4





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




Zmień prawa/atrybuty pliku licznik.txt na 775.
Go to the top of the page
+Quote Post
-sapper-
post 5.11.2007, 13:30:59
Post #5





Goście







Dopisałem to:

  1. <?php
  2. chmod("licznik.txt", 775);
  3. ?>


Wywala mi to:

Warning: chmod() [function.chmod]: Operation not permitted in /usr/local/www/data/virtual/band.pl/magicmushroom/htdocs/index.php
Go to the top of the page
+Quote Post
Cysiaczek
post 5.11.2007, 16:14:04
Post #6





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Musisz je zmienić mając do tego uprawnienia. W praktyce zrób to poprzez program FTP.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 04:39