SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XHTML Validation errors using PHP sessions

    Hi all,

    My site validated as XHTML 1.0 beautifully until I started using PHP sessions. Now I'm getting errors such as:

    Line 18 column 113: general entity "PHPSESSID" not defined and no default entity.
    The most common cause of this error is unencoded ampersands in URLs
    Reading the explanation, it seems that the ampersands that are automatically inserted by using the session aren't encoded properly. Problem is I don't have any control over this.

    I'm wondering if I can sort this out using mod_rewrite? Any ideas how I'd go about it as I have zero experience of using it.

    Many thanks
    Kevin

  2. #2
    SitePoint Guru gavwvin's Avatar
    Join Date
    Nov 2004
    Location
    Cornwall, UK
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can put in .htaccess file

    php_flag session.use_trans_sid off

    which will prevent php appending &phpsessid=... to your urls. Your documents validate but people who have cookies turned off can't use you session features- I suppose you have to decide which is more important to you.

  3. #3
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply gav. I had another tip which doesn't require a .htaccess file, I just put this at the top of my pages:

    ini_set('arg_separator.output','&');

    Seems to work just fine.

    Regards

  4. #4
    SitePoint Addict WarpNacelle's Avatar
    Join Date
    Aug 2005
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, just in case you're wondering where that suggestion went - I posted it then removed it later because, after re-reading your first post, it sounded like you didn't have control over the "&" in the links and it wouldn't work.

    Anyway, glad it did.


  5. #5
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warp,
    You had me thinking I was going mad... I saw it there, next minute I looked it had gone! Just glad I didn't try to take credit for your excellent advice

    Regards
    Lar

  6. #6
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tis a common problem indeed. Glad it's all sorted.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  7. #7
    SitePoint Addict WarpNacelle's Avatar
    Join Date
    Aug 2005
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    A wavering moment of lack-of-confidence in my advice. Won't happen again!



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
  •