On 09/12/2010 10:01 PM, Dan Mahoney, System Admin wrote:
On Thu, 9 Dec 2010, Charles Ferland wrote:
Hi
I have a client who wants to run .js file under mod_suphp because
some files after processing doesn't get the right permission owner.
For .php file, I have it working with mod_suphp but when I'm trying
the same thing for .js extension, nothing seems to be working.
Javascript (.js) files are generally served up as straight ascii to
the client, not executed on the webserver.
Are you trying to somehow embed php code INTO your javascript files to
make dynamic javascript?
-Dan Mahoney
Yes exactly! Sorry for the missing information.
I'm looked into the .js test files from the client and it seems to be
the fact.
Example (sorry for French language)
****
js.js
****
js.js
<?php
header("Content-Type: text/javascript; charset=utf-8");
session_start();
ini_set("display_errors",1);
error_reporting(E_ALL);
print_r($_SESSION);
?>
/**
* Code php dans le fichier JS, charger a partir du browser
* <script src="js.js"></script>
*
* Débute la session
* ?php session_start();?
* Change le mine type en text/javascript ( pour le browser )
* ?php header("Content-Type: text/javascript"); ?
*/
/**
* Les valeurs sont prient à partirdes des variables sessions
*
* var session_path = '?php echo session_save_path();?';
* var session_id = '?php echo session_id();?';
* var session_name = '?php echo session_name();?';
*/
var session_path = '<?php echo session_save_path();?>';
var session_id = '<?php echo session_id();?>';
var session_name = '<?php echo session_name();?>';
function alertPath() {
alert('dossier des sessions : ' + session_path);
return false;
}
function alertId() {
alert('ID de la session : ' + session_id);
return false;
}
function alertName() {
alert('Nom de la session : ' + session_name);
return false;
}
_______________________________________________
suPHP mailing list
[email protected]
https://lists.marsching.com/mailman/listinfo/suphp