Forum Moderators: phranque

Message Too Old, No Replies

php value auto prepend file PATH

         

Blade_Stom

10:54 pm on May 5, 2009 (gmt 0)

10+ Year Member



I have a problem with php_value auto_prepend_file. I have this code:

<FilesMatch "\.css$">
AddHandler application/x-httpd-php .css
php_value default_mimetype "text/css"
php_value auto_prepend_file /filesToInclude/compress.php
</FilesMatch>

The path /filesToInclude/compress.php is an absolute path, however, as I have started with <FilesMatch "\.css$"> the "script" is looking this path /filesToInclude/compress.php starting from the .css file path and not from the "Root" Path.
What shall I do to specify that this path /filesToInclude/compress.php should be looked for starting from the ROOT PATH?

Thxx

jdMorgan

11:56 pm on May 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This has nothing to do with the <FilesMatch> container. <FilesMatch> makes the contained directives conditional upon matching the .css filetype, but ahs no effect on resolving the prepended file's location.

Rather, your problem likely has to do with where php thinks your php.ini or .htaccess file is "rooted" versus your "absolute" path.

I note from a search that PHP4.0 Beta 1 had a problem with auto_prepend, so check your php version number as well.

Jim

Blade_Stom

8:34 am on May 6, 2009 (gmt 0)

10+ Year Member



Iīm sorry but I canīt understand your explanation. However, I have try this (it could be useful to know what happens):

I have put a copy compress.phpfile inside each css directory (doing manually the copy paste copy paste copy paste of the file); and the I have change the code putting this one:

<FilesMatch "\.css$">
AddHandler application/x-httpd-php .css
php_value default_mimetype "text/css"
[b]php_value auto_prepend_file ./compress.php[/b]
</FilesMatch>

THIS WORKS PERFECT! (The "problem" is that I have 25 copies of the same file. ) Thatīs why I said in the last message that the I think that the use of FilesMatch makes that php_value auto_prepend_file starts looking for the path starting for the .css file location.

What can I do to use just a copy of compress.php?

My verison of PHP is 5.2.6

jdMorgan

12:58 pm on May 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



...the use of FilesMatch makes that php_value auto_prepend_file start looking for the path starting at the .css file location.

No it does not. It only allows the enclosed code to execute if the filetype is ".css". That is all that it does.

What can I do to use just a copy of compress.php?

This is likely a server configuration problem, or a limitation of the type of hosting account you are using. If you defined this domain using a "control panel," then it may not be possible to access any files "above root" using HTTP. If that is the case, look into defining a symlink in each domain to serve as an alias for your shared file(s). (If you're not familiar with symlinks, they are somewhat similar to 'Windows shortcuts.' But on *nix, they are file-system links to a file in a different location, and they behave exactly as if they are 'real files.' Generally, they must be created using a console log-in, and cannot be created using FTP or HTTP 'upload' tools. If you cannot use a console login on this server, you may have to request that your host install these symlinks for you.)

Jim