SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 34
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with PHP Coding

    Hi, I want to do this but I keep getting errors. I installed Pear, but when I run table.php I get:

    Warning: Cannot send session cookie - headers already sent by (output started at c:\phpdev5\www\php stuff\table.php:6) in c:\phpdev5\www\php stuff\check_login.php on line 10

    Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\php stuff\table.php:6) in c:\phpdev5\www\php stuff\check_login.php on line 10

    Warning: open(/tmp\sess_e21914d99b8b8682442389f4e39427d7, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\php stuff\check_login.php on line 10
    DB Created Successfully
    Warning: open(/tmp\sess_e21914d99b8b8682442389f4e39427d7, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

    Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
    Also, when I run register.php and attempt to register I get:

    Fatal error: Call to a member function on a non-object in c:\phpdev5\www\php stuff\register.php on line 26
    Is it possible to do this script without Pear? I have PHP & MySQL installed and working correctly
    Last edited by c.barber; Apr 30, 2005 at 13:53.

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Edit your php.ini and change session.save_path to a valid windows directory, for example:
    c:\sessions

    Then restart the webserver. That should stop the first lot of errors. The second one might be unrelated, but see what happens after making the php.ini change

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your speedy reply! I am new to PHP, and sorry if this is a stupid question, but where is the php.ini located?

  4. #4
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you on Shared Hosting?

  5. #5
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no, sorry this is on my own computer, I found the file edited it to "C:\phpsession" and restarted everthing, but it still says:

    Warning: Cannot send session cookie - headers already sent by (output started at c:\phpdev5\www\php stuff\table.php:6) in c:\phpdev5\www\php stuff\check_login.php on line 10

    Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\php stuff\table.php:6) in c:\phpdev5\www\php stuff\check_login.php on line 10

    Warning: open(/tmp\sess_4b65e6cf5d067da12738e6f3f77ab47f, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\php stuff\check_login.php on line 10
    Table created successfully.
    Warning: open(/tmp\sess_4b65e6cf5d067da12738e6f3f77ab47f, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

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

  6. #6
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first two errors are due to you trying to call session_start(); after output to the browser.

    Deletre all out put before that call and then try again.

  7. #7
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't look like shared hosting going by the paths in the errors.
    To locate the php.ini file create a file like:
    <?php phpinfo() ?>
    It will tell you at the top where the php.ini is, but it's probably in c:\windows\system32

  8. #8
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warning: open(/tmp\sess_4b65e6cf5d067da12738e6f3f77ab47f, O_RDWR) failed:
    session.save_path is still set to the Unix default of /tmp .. you need to locate your php.ini file and change it to an existing windows path (c:\sessions or c:\temp for example).

  9. #9
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markl999
    Doesn't look like shared hosting going by the paths in the errors.
    Keen obsevation

  10. #10
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it says my php.ini file is in c:\winnt but no such folder exists on my computer

  11. #11
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I searched for php.ini and it found one only, in C:\phpdev5\gtkdev\php4

    This is the one I already changed to C:\phpsessions

  12. #12
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's not the php.ini you want. You may not even have a php.ini in which case you can copy either php.ini-dist or php.ini-recommended from your php install/source directory to c:\winnt\php.ini (and make the session.save_path change in that php.ini file).

  13. #13
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not sure exactly what I did, but now when I run table.php I get:

    Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\php stuff\table.php:6) in c:\phpdev5\www\php stuff\check_login.php on line 10
    Tables created succesfully
    How do I get rid of this?

    Also, when I try to run register.php, I get
    Fatal error: Call to a member function on a non-object in c:\phpdev5\www\php stuff\register.php on line 26
    Line 26 of register.php says:
    $name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'");

  14. #14
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The warning is from output to the browser before that line.

    You have to call that line FIRST.

  15. #15
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, I can register and everything ow, but I get this error also once I registered:

    Warning: Unknown modifier '/' in c:\phpdev5\www\php stuff\register.php on line 81

  16. #16
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me see line 81
    Edit:


    Quote Originally Posted by c.barber
    Line 26 of register.php says:
    $name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'");
    I hope that database class is doing some validation on that input.

  17. #17
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now I get:

    Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\php stuff\register.php:9) in c:\phpdev5\www\php stuff\check_login.php on line 10
    and
    Warning: Unknown modifier '/' in c:\phpdev5\www\php stuff\register.php on line 81
    when I register

  18. #18
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dylannn
    Let me see line 81
    Edit:




    I hope that database class is doing some validation on that input.
    Line 81:

    if ($_POST['website'] != '' & !preg_match("/^(http|ftp):///", $_POST['website'])) {

  19. #19
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\php stuff\register.php:9) in c:\phpdev5\www\php stuff\check_login.php on line 10
    Let me see line ten.

    And about the other error, I'm pretty sure that has to do with RegEx, which I do not know.

  20. #20
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    line 10 of what? register.php or check_login.php?

  21. #21
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    register.php

  22. #22
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://172.188.222.101/public/php stuff/index.htm

    Go here to see the php errors/pages

  23. #23
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to see the php source.

    Give me line ten of check_login.php

  24. #24
    SitePoint Member
    Join Date
    Apr 2005
    Location
    East Anglia, England
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok here it is:

    session_start();

  25. #25
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like I said, about 24 times, taht needs to be called before any other output to the browser.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •