FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


May I ask to enable or load the apache module





blueray
Hi, I have been checked out the phpinfo on the hosting server.
And it seems that there are not loaded or enabled this apache module.

May I ask / inquery to enable it for easy adding HTTP headers.

Module names: mod_expires


Thanks,
rvec
you can use php to do the same, with less effort and more flexibility.
http://php.net/manual/en/function.header.php
blueray
Rvec

Yes, you are right.

But I use that for some unchanged items.
Such as images, javascript, style files etc.

If do that with php script.
I might need with this construction.

<img src="download.php?pid=xxx" alt="" title="" />

Please correct me if that is wrong.
As there are many way to do.
I just knew a bit.

Smile

Thanks,
rvec
I don't really get what you want.
If you want to change the headers of an image file you can use the php headers function in combination with this function:
http://nl.php.net/manual/en/function.fpassthru.php

That way you can first set the headers you want, and then send all the contents of a file to the browser. You could also redirect all requests for images to one php file which handles that. For example you have all your images in an images directory and in there you add a images.php and .htaccess file like this:
the .htaccess:
Code:
RewriteRule ^(.*)$ images.php?image=$1

and images.php:
Code:

$file = pathinfo($_GET['image']);
if (!is_file($file['basename'])) {
  $handle = fopen('no_image.png');//This image will be shown if a non-existing or invalid image was requested
} else {
  $handle = fopen($file['basename']);
}
header("Expires: 0");
header('Content-Type: image/jpeg'); //you should probably put a switch here so you get the right content type depending on $file['extension']
fpassthru($handle);
fclose($handle);
blueray
rvec

Actually I have some simliar code that I was planned to.
I wish don't let thing too complex if there is a simple way to go.
Also, I have missed something on the phpinfo and doing a test
to if mod_headers could archive what I wanted to do.

I will go this way as my last sort.
Because simple is better.


Thanks for you help, Smile
I learned a lot from you.
cr3ativ3
Adding onto what rvec said, if you don't like the fact that the image in the html the tag has .php ending you can use .htaccess to have .png or .gif or .jpg etc... in a certain directory be parsed by PHP's engine...

See below for an example of such a file.

File: .htaccess
Code:

AddType application/x-httpd-php .php .jpg # Run .jpg file as .php file.
AddType application/x-httpd-php .php .gif # Run .gif file as .php file.
AddType application/x-httpd-php .php .png # Run .png file as .php file.


You would put this .htaccess file into the directory where your .jpg/.gif/.png file lies, the contents of this file however would really be php.

If any of that doesnt make sense let me know!
rvec
with the solution I posted you can just request the image files like before, but all requests will be redirected to the php file. The only problem in my script (I just found out) is that it is possible to output the script itself, but that'd be easy to fix by changing:
Code:
if (!is_file($file['basename'])) {

to
Code:
if (!is_file($file['basename']) OR ($file['basename'] == 'images.php')) {


The other advantage of my solution is that you'll have a fall-back image, when you delete an image that is still being used somewhere.

With your solution you'd also have to create a php file for every image (or image type) instead of one to rule them all Smile
Related topics
Show PHP Code
Slight Server Problem
installing apache,mysql and php on windows
only .htaccess instead of mod_rewrite
Proactively connecting Apache to the browser
make a server - with php and MySQL
dual boot
Authentication Module
PHP5 MySQL Config on XP
Apache 2.0.59 and PHP5 are not friends...
Download Management
Making my liquid cooling, even cooler
Running a script multiple times
phpMyAdmin
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.