Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> sesja i błędy
boxer
post
Post #1





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 15.03.2005

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


Witam!

Pierwsze podejscia do sesji i juz niepowodzenie:

Zawartosc pliku strona1.php

  1. <?php
  2.  
  3. $_SESSION['zmienna'] = &#092;"Witaj\";
  4.  
  5. echo 'Zawartość zmiennej '.$_SESSION['zmienna'].'<br />';
  6.  
  7. ?>
  8. <a href=\"strona2.php\">Następna strona</a>


Plik strona2.php

  1. <?php
  2.  
  3. echo 'Zawartość zmiennej '.$_SESSION['zmienna'].'<br />';
  4.  
  5. ?>


Na pierwszej stronie otrzymuje zawartość zmiennej, a na drugiej już nie?
Podjrzewam iż możliwe że coś mam jeszcze wyłączone.? W php.ini register_globals ustawiłem na on. Trzeba jeszcze coś poprzestawiać aby to zadziałało?

2 pytanie co zrobić aby wyświetlały się błędy (np. gdy zapomnę średnika), aktualnie w takim przypadku mam pustą białą stronę i muszę się domyśleć w którym miejscu jest błąd.

Apache 1.3.27, php 4.3.0


--------------------
mysql:4.0.21-nt, apache 1.3.27, PHP 4.3.0
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 9)
ferr
post
Post #2





Grupa: Zarejestrowani
Postów: 122
Pomógł: 3
Dołączył: 18.12.2004

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


a przed session_start w drugim pliku nie przesylasz jeszcze jakis naglowkow? Ewentualnie do linka pierwszym pliku dodaj SID smile.gif

Ten post edytował ferr 19.03.2005, 19:40:24


--------------------
Go to the top of the page
+Quote Post
boxer
post
Post #3





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 15.03.2005

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


Niczego więcej nie przesyłam. Powyższy listing zawiera CAŁE całe pliki. Są to przykładowe pliki zaczerpnięte z książki. Ale w książeczce pisze, iż również na 2 stronie powinna się wyświetlić zawartość zmiennej. Niestety u mnie się nie udało sad.gif


--------------------
mysql:4.0.21-nt, apache 1.3.27, PHP 4.3.0
Go to the top of the page
+Quote Post
ferr
post
Post #4





Grupa: Zarejestrowani
Postów: 122
Pomógł: 3
Dołączył: 18.12.2004

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


  1. <?php
  2.  
  3. $_SESSION['zmienna'] = &#092;"Witaj\";
  4.  
  5. echo 'Zawartość zmiennej '.$_SESSION['zmienna'].'<br />';
  6. echo &#092;"<a href=strona2.php?'.PHPSID.'>Następna strona</a>\";
  7. ?>


Ten post edytował ferr 19.03.2005, 19:57:24


--------------------
Go to the top of the page
+Quote Post
boxer
post
Post #5





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 15.03.2005

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


Niestety ciągle nie działa!


--------------------
mysql:4.0.21-nt, apache 1.3.27, PHP 4.3.0
Go to the top of the page
+Quote Post
ferr
post
Post #6





Grupa: Zarejestrowani
Postów: 122
Pomógł: 3
Dołączył: 18.12.2004

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


no to raczej cos w ustawieniach php, lecz tu juz ci nie jestem w stanie pomoc.


--------------------
Go to the top of the page
+Quote Post
boxer
post
Post #7





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 15.03.2005

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


Udało mi się uruchomić wyświetlanie błędów:

Oto co ukazuje się na stronie1.php

Kod
Warning: session_start() [function.session-start]: open(/tmp\sess_c569f160e5da918ba8130c760445f97e, O_RDWR) failed: No such file or directory (2) in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona1.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona1.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona1.php on line 3
Zawartość zmiennej Witaj
Następna strona
Warning: Unknown(): open(/tmp\sess_c569f160e5da918ba8130c760445f97e, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0


a strona2.php
Kod
Warning: session_start() [function.session-start]: open(/tmp\sess_a9a5650d3bec25d09ce26059e3aa60cb, O_RDWR) failed: No such file or directory (2) in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona2.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona2.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona2.php on line 2

Notice: Undefined variable: SESSION in e:\Program Files\Apache Group\Apache\htdocs\pawel\strona2.php on line 5
Zawartość zmiennej wynosi
Następna strona
Warning: Unknown(): open(/tmp\sess_a9a5650d3bec25d09ce26059e3aa60cb, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0


a zawartość php.ini

Kod
[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use php's session functions.
session.save_path = /tmp

; Whether to use cookies.
session.use_cookies = 1

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data.  php is the standard serializer of php.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_dividend,
; e.g. 1/100 means 1%.

session.gc_probability = 1
session.gc_dividend    = 1000

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; php 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, albeit register_globals
; is disabled.  php 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning seperately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled.

session.bug_compat_42 = 0
session.bug_compat_warn = 1

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public,} to determine HTTP caching aspects.
; or leave this empty to avoid sending anti-caching headers.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
;   to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
;   in publically accessible computer.
; - User may access your site with the same session ID
;   always using URL stored in browser's history or bookmarks.
session.use_trans_sid = 0

; The URL rewriter will look for URLs in a defined set of HTML tags.
; form/fieldset are special; if you include them here, the rewriter will
; add a hidden <input> field with the info which is otherwise appended
; to URLs.  If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a "=", even if no value follows.
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"


System to XP pro na partycji E

Prosze o pomoc.


--------------------
mysql:4.0.21-nt, apache 1.3.27, PHP 4.3.0
Go to the top of the page
+Quote Post
-Tomal-
post
Post #8





Goście







Wydaje mi sie ze musisz ustawić zmienną
Kod
session.save_path = c:\PHPsession

w pliku php.ini
Go to the top of the page
+Quote Post
boxer
post
Post #9





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 15.03.2005

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


Wielkie dzięki to było to!

Tylko dlaczego podczas instalacji samo się to nie wykonuje questionmark.gif!??


--------------------
mysql:4.0.21-nt, apache 1.3.27, PHP 4.3.0
Go to the top of the page
+Quote Post
ein
post
Post #10





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 15.03.2005

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


a jak okreslic ta sciezke na serverze online?
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 Aktualny czas: 22.08.2025 - 00:54