I am trying to do something like this, without success:
Code: Select all
SetEnv ROOT $_SERVER['DOCUMENT_ROOT']Code: Select all
echo $_SERVER['ROOT']Moderator: General Moderators
Code: Select all
SetEnv ROOT $_SERVER['DOCUMENT_ROOT']Code: Select all
echo $_SERVER['ROOT']Code: Select all
SetEnv name valueCode: Select all
SetEnv foo barCode: Select all
SetEnv FOO "bar"Code: Select all
echo $_SERVER['FOO'];Please explain this differently.However, I want to make the variables a little bit more clever in adding SERVER variables to generated SERVER variables...
I think he means like his example which uses $_SERVER variables. (Uses $_SERVER variables to create different variables)ole wrote:Please explain this differently.However, I want to make the variables a little bit more clever in adding SERVER variables to generated SERVER variables...
Yup. I was just wondering if there were .htaccess equivalents, since I have seen a few people use things like {HTTP_REFERER} to block spam comments with mod_rewrite.Zoxive wrote:Which is not possible at all, in the .htaccess file. Because PHP has not been ran yet, so those variables are not available yet. Even if they were, Apache doesn't even know what do to with them, or how to get them.
I am, at the moment. This is what I am using:Zoxive wrote:Possible Solution: Why do you have to do this in the .htaccess file? Why not do it at the beginning of an include?
Code: Select all
define('P', $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']);auto_prepend_fileHowever, I would like to add it to setenv it so I can use it throughout the site without having to redeclare the constant (At the moment I am declaring it in the index.php and the autoload.php).
Code: Select all
RewriteEngine on# won't rewrite listed extension, alternatively you can wrap the rewrite in a <Directory>RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.phpCode: Select all
php_value auto_prepend_file 'file'I don't understandole wrote:You know you can set php configuration options in .htaccessCode: Select all
php_value auto_prepend_file 'file'
I don't understand how that would solve my problem.
No - since the project will be available to download I don't want people to need to alter anything to do with config files. The whole point in my project is that it is simple for people new to programming to quickly install and use.ole wrote:It means that you are able to alter the configuration of PHP before runtime without touching httpd.conf. I suspected you thought that wasn't possible and was the reason for you rejecting auto_prepend_file as a solution to your problem.
Exactly. Just like the OP, you wanted to accomplish setting some Server Variables in the .htaccess, which can not be done directly. But using the method ole has been talking about you can Call a file every time php is called.someberry wrote:No - since the project will be available to download I don't want people to need to alter anything to do with config files. The whole point in my project is that it is simple for people new to programming to quickly install and use.ole wrote:It means that you are able to alter the configuration of PHP before runtime without touching httpd.conf. I suspected you thought that wasn't possible and was the reason for you rejecting auto_prepend_file as a solution to your problem.
Code: Select all
php_value auto_prepend_file '_autoload.php'Code: Select all
<?php
define('P', $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']);