Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Problem z Tworzeniem Pliku
Matimor
post 19.09.2009, 11:47:14
Post #1





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


Mam taki problem: przy mojej rejestracji po zakończeniu ma się tworzyć plik o nazwie użytkownika, a treść pliku ma mieć to co jest w Przyklad.txt

  1. else
  2. {
  3. $file = $acc_nick.".txt";
  4. if(!file_exists($file))
  5. {
  6. copy("/data/serwer/Przyklad.txt", $file);
  7. setData($file, "E-Mail", $mail);
  8. setData($file, "Plec", $plec);
  9. setData($file, "Adres", $img);
  10. setData($file, "Wiek", $wiek);
  11. $blad = "<font color=green><b>Konto pomyślnie utworzone.</b></font><br><br>";
  12. } else { $blad = "<font color=red><b>Ta Nazwa Konta Jest Już Zajeta !</b></font><br><br>"; }
  13. }



I mam masę błędów na WWW

Ten post edytował Matimor 19.09.2009, 11:47:35


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 11:54:38
Post #2





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Cytat
I mam masę błędów na WWW
A ja mam masę odpowiedzi w głowie.

Jakie błędy?


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 11:59:52
Post #3





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


  1. Warning: copy(Przyklad.txt) [function.copy]: failed to open stream: No such file or directory
  2.  
  3. Warning: file_get_contents(.txt) [function.file-get-contents]: failed to open stream: No such file or directory
  4.  
  5. Warning: file_put_contents(.txt) [function.file-put-contents]: failed to open stream: Permission denied
  6.  
  7. Warning: file_get_contents(.txt) [function.file-get-contents]: failed to open stream: No such file or directory
  8.  
  9. Warning: file_put_contents(.txt) [function.file-put-contents]: failed to open stream: Permission denied
  10.  
  11. Warning: file_get_contents(.txt) [function.file-get-contents]: failed to open stream: No such file or directory
  12.  
  13. Warning: file_put_contents(.txt) [function.file-put-contents]: failed to open stream: Permission denied
  14.  
  15. Warning: file_get_contents(.txt) [function.file-get-contents]: failed to open stream: No such file or directory
  16.  
  17. Warning: file_put_contents(.txt) [function.file-put-contents]: failed to open stream: Permission denied
  18.  
  19. Warning: file_get_contents(.txt) [function.file-get-contents]: failed to open stream: No such file or directory
  20.  
  21. Warning: file_put_contents(.txt) [function.file-put-contents]: failed to open stream: Permission denied


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 12:09:15
Post #4





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Cytat
Warning: copy(Przyklad.txt) [function.copy]: failed to open stream: No such file or directory
Nie ma takiego pliku. W błędzie masz napisane, że nie ma pliku Przyklad.txt, a w kodzie podałeś ścieżkę /data/serwer. Sprawdź dokładnie jakie ścieżki ustawiasz, a następnie, czy podany plik istnieje.

Pozostałe błędy albo same znikną w momencie poprawienia pierwszego błędu, albo będzie musiał zrobić to samo, czyli sprawdzić ścieżki.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 12:11:25
Post #5





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


Ten plik istnieje na serwerze... Dałem nawet adres względny www.cos.pl/data/serwer/Przyklad.txt i nadal ten błąd był...


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 12:33:01
Post #6





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Skoro plik istnieje, to sprawdź, czy nie zrobiłeś literówki w nazwie pliku. Pamiętaj, że wielkość lite ma znaczenie. No i sprawdź, czy masz uprawnienia do zapisu nowego pliku.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 12:36:41
Post #7





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


Wszystko jest nazwałem plik xxx, dałem chmod 777, dałem chmod 777 katalogowi i to samo :/


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 12:40:01
Post #8





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




A gdzie tworzysz nowy plik?


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 12:40:29
Post #9





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


W tym samym katalogu gdzie znajduje się przykładowy.


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 12:47:59
Post #10





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




No to jeszcze jedno pytanie.
Gdzie znajduje się skrypt, który kopiuje pliki? Też w tym samym katalogu do Przyklad.txt i nowy plik?


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 12:50:02
Post #11





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


Nie, znajduje się w osobnym katalogu.

Teraz mam taki błąd:
  1. failed to open stream: HTTP wrapper does not support writeable connections


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 12:54:33
Post #12





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Skoro skrypt, który kopiuje pliki znajduje się w innym miejscu, to do funkcji copy musisz podać nazwy plików wraz ze ścieżkami. Jeśli podasz tylko nazwę pliki, to skrypt będzie chciał go utworzyć plik w miejscu, w którym ten skrypt się znajduje. A że nie ma uprawnień, to zgłasza błąd.

Błąd który się pojawił oznacza, że nie możesz używać funkcji copy z adresami www. Ścieżkę musisz podać nie jako adres url, a jako ścieżkę katalogów na serwerze.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 12:55:39
Post #13





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


Podawałem i w ścieżce i jaki http i mam nadal ten sam efekt...


--------------------
Go to the top of the page
+Quote Post
batman
post 19.09.2009, 13:18:18
Post #14





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Napisz jaką masz strukturę katalogów od root-a począwszy. Wskaż gdzie jest skrypt, który ma kopiuje pliki oraz katalogi skąd o dokąd są kopiowane pliki.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
Matimor
post 19.09.2009, 13:30:09
Post #15





Grupa: Zarejestrowani
Postów: 287
Pomógł: 10
Dołączył: 22.08.2009

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


Ok zrobiłem to i działa, ale teraz mam inny problem. Jak mam wstawić adres pliku w http: jako touch? Na wcześniejszym hostingu się dało na VPS się nie da.


--------------------
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: 14.07.2025 - 07:20