bookmark - Xhtml Validation With Php In Cgi Mode

Xhtml Validation With Php In Cgi Mode

 
 Discussion by TavoxPeru with 0 Replies.
 Last Update: April 1, 2007, 9:23 am
 
bookmark - Xhtml Validation With Php In Cgi Mode  
    
free web hosting
 
Hi,

Recently the host server of one of my clients change its PHP installation from the Apache mode to the CGI mode so because of this change i got some problems. For example, whatever page i view it shows these warnings at the top of the page:
Warning: session_start() [function.session-start]: open(/tmp/sess_b05e459fe625d81a303b59982be3da39, O_RDWR) failed: Permission denied (13) in /home/client_username/public_html/functions.php on line 9

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/client_username/public_html/functions.php:9) in /home/client_username/public_html/functions.php on line 9

And these ones at the bottom:
Warning: Unknown(): open(/tmp/sess_b05e459fe625d81a303b59982be3da39, O_RDWR) failed: Permission denied (13) 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
Another problem occurs when i try to validate the php page -includes forms and links that use sessions- as a strict xhtml 1.1 page with the W3C XHTML VALIDATOR, it consists that everytime i send it to the validator it creates a hidden input with the PHP PHPSESSID in the form and also adds to the href attribute of every link this PHPSESSID, for this problem i got the solution a time ago as stated in this topic: but because of the change of the PHP mode as i say before the page dont validate.

After some tests and research at the PHP site i finally solve this problems by using the ini_set php function to set the url_rewriter.tags, the arg_separator.output and the session.save_path in every php page that you want to be valid xhtml1.1 as the following code:

CODE

<?php
ini_set("session.save_path","/home/client_username/tmp/");
ini_set ("arg_separator.output", "&");
ini_set("url_rewriter.tags","a=href,area=href,frame=src,input=src");
if (session_id() == "")
session_start();
?>

Because PHP is in CGI mode i notice that i can not use a .htaccess file so i add the previous code in a general php file and include it to my pages with the include() php function, and also, i change the permissions of the folder that i set in the session.save_path to be writable -chmod 750- and now every thing works perfectly and the page is a valid XHTML 1.1 file.

Hope that this helps someone.

Best regards,

Sun Apr 1, 2007    Reply    New Discussion   


Quickly Post to Xhtml Validation With Php In Cgi Mode  w/o signup Share Info about Xhtml Validation With Php In Cgi Mode  using Facebook, Twitter etc. email your friend about Xhtml Validation With Php In Cgi Mode Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

Php - Object Oriented Programming   Php - Object Oriented Programming (1) (2) Need Phpbb To Nuke Help   Need Phpbb To Nuke Help