Jump to content
xisto Community
TavoxPeru

Xhtml Validation With Php In Cgi Mode

Recommended Posts

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:
<?phpini_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,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.