Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Replying to Xhtml Validation With Php In Cgi Mode


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

TavoxPeru

Posted 01 April 2007 - 09:23 AM

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: Problem With Xhtml Validation 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:
<?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,

Review the complete topic (launches new window)