This is a discussion on SetHandler won't work in '.htaccess' within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi. Working with Apache 2 on Linux, I'm trying to make 'whatever.foo' be executed as a PHP file ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi.
Working with Apache 2 on Linux, I'm trying to make 'whatever.foo' be executed as a PHP file within my 'http://homeserver' (/home/user/html) So I inserted a .htacess within '/home/user/html': -------------- SetHandler application/x-httpd-php -------------- And I created 'test' file: ------------------- <?php print "Hello World!\n"; ?> ------------------ But when accessing 'http://homeserver/test' I can only see the PHP code, but not "Hello World". What am I doing wrong? Thxs |
|
|||
|
[francescomoi@europe.com wrote in comp.infosystems.www.servers.unix]
> Working with Apache 2 on Linux, I'm trying to make 'whatever.foo' be > executed > as a PHP file within my 'http://homeserver' (/home/user/html) > So I inserted a .htacess within '/home/user/html': > SetHandler application/x-httpd-php > And I created 'test' file: ><?php > print "Hello World!\n"; > ?> > But when accessing 'http://homeserver/test' I can only see the PHP > code, 2but not "Hello World". What am I doing wrong? Is Apache's php support compiled as a module ? If so, do you have a line along the lines of : LoadModule php4_module /usr/lib/apache/1.3/libphp4.so in your httpd.conf ? You'd also need to use : ForceType application/x-httpd-php in your .htaccess instead of SetHandler. -- http://fotoserve.com/ - Prints, Slides, Posters, Mugs, T-shirts,, Calendars, Jigsaws, Tableware, Caricatures, Greetings cards, Picture bags, Photo Album and Book covers, Canvas Prints, tissues and more ..... from your own digital images. |
|
|||
|
Andy Davidson wrote:
> [francescomoi@europe.com wrote in comp.infosystems.www.servers.unix] > > Working with Apache 2 on Linux, I'm trying to make 'whatever.foo' be > > executed > > as a PHP file within my 'http://homeserver' (/home/user/html) > > So I inserted a .htacess within '/home/user/html': > > SetHandler application/x-httpd-php > > And I created 'test' file: > ><?php > > print "Hello World!\n"; > > ?> > > But when accessing 'http://homeserver/test' I can only see the PHP > > code, 2but not "Hello World". What am I doing wrong? > > Is Apache's php support compiled as a module ? If so, do you have > a line along the lines of : > > LoadModule php4_module /usr/lib/apache/1.3/libphp4.so > > in your httpd.conf ? Yes. It's a PHP-compiled Apache server and I've got the line you mentioned. > > You'd also need to use : > > ForceType application/x-httpd-php > > in your .htaccess instead of SetHandler. I did it, but it doesn't work. :( |
| Thread Tools | |
| Display Modes | |
|
|