Category Archives: addhandler

APACHE 2.4 AddHandler cgi-script.cgi

Simple Question. I have apache 2.4 running on centOS 7 and I am configuring VirtualHosts with different directives inside each. In one of them I need to allow scrips so I add the directive in this way and I am getting error once I restart apache service

NameVirtualHost 192.168.134.132:9024
<VirtualHost www.web.com>
        DocumentRoot /var/www/html/web
        ServerName www.web.com
        <Directory /var/www/html/web>
        Options FollowSymLinks
        </Directory>
        <Directory /var/www/html/web/cgi-bin-web>
        Options +ExecCGI
        AddHandler cgi-script.cgi 
        </Directory>
</VirtualHost>

I put it into a different Directory tags and create the cgi folder into the apache structure to test. Same result.

Error: sudo systemctl restart httpd.service Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Any idea?

PHP AddHandler Blocking Another AddHandler

I am trying to run a PHP script on an html page and I have figured out that I need to add the following to my htaccess file:

AddHandler application/x-httpd-php .html

So I did that and it allowed the PHP script to run as needed, but it also blocked another AddHandler from running, which I use for html include files such as sitewide navigation and ads.

This is what my htaccess file looks like:

Options +Includes
AddHandler server-parsed .html

AddHandler application/x-httpd-php .html

For whatever reason the Options +Includes AddHandler gets blocked when I add the PHP AddHandler, which means the sitewide include files do not display as they usually do.

Is there a way to have both AddHandler commands running without one blocking the other?

Thanks for any help...

Using the Apache Action/AddHandler directives without an input file

Apache's AddHandler and Action directives work together to launch a dedicated cgi script whenever Apache receives a request for a file with a name that ends with a specific extension. Common usage is that the cgi script processes the content of the requested file much like a filter. However, that is not required. Once Apache receives a request for a file with the specific extension, the cgi-script is triggered and it can do whatever it wants. It is my understanding that in Apache 1.3, the requested file did not even have to exist. This is convenient because one may want to use a URL to trigger some action in a cgi script which does not necessarily involve a file. It appears that in Apache 2.0, the requested file must actually be present even though it may not be used. Here's my question: Is there any way that we can make it so that we don't have to include these unused files just to keep Apache happy? Thanks for any input.

 ... doug

addtype in htaccess doing nothing

i've been playing around with htaccess and decided to find more about file extensions, so i added this to my htaccess:

AddType x-httpd-php .po
AddHandler php5-script .po

to add extension .po for php files, but it just does nothing except comment my php in it, what shall i do about it to make .po to handle php code and here's my code in code inspector(from my browser in .po file)

<!--

?php
echo 'hi'; //just to test if works
?

--> //this and anything below not mine
<html>
    <head></head>
    <body>
    </body>
</html>

apache .htaccess AddHandler php for version 5.3.2

I am trying to force my pre-installed Apache 2.2.26 (unix) on OS X Mavericks to use a certain version of php (v5.3.2) on a specific project through a .htaccess file, but can't seem to get it working :-/

I have the following .htaccess config:

<FilesMatch "\.php$">
    AddHandler application/x-httpd-php53 .php
</FilesMatch>

This is wrote based on the following site http://kb.site5.com/php/how-to-change-your-php-version/.

The problem is that every time i try to get the index.php, the browser just downloads the index.php as a file called "download". So my first thought is that i dont have the handler x-httpd-php53, but i can't seem to figure out how i list my available handlers, and if the handler is not available, how do i install it ? Currently "PHP 5.4.24 (cli)" is installed. Anyone can help me out :-) ?

As said above, I have the default OS X Mavericks installation of apache and php, and i havent done anything to it yet. I am pretty green when it comes to handlers in apache, so any info will be appreciated :-)

NOTE: The reason i want to do this, is because of a production server which is running php v5.3.2 and i need to emulate this environment, so i am certain we use compatible functions etc. during development.