# Apache hide extension



## hac3ru (Mar 31, 2014)

Hello,

I am running FreeBSD 9.2 with Apache2.4 and php5.5.1. I want to transform /hostaname/main.php into /hostname/main... I was able to do this on some Ubuntu but on FreeBSD I can't get it to work. Anyone can help me out?


----------



## Chris_H (Apr 7, 2014)

Hmmm. That's odd. I don't have that problem, myself. I get exactly the same results that you're looking for, on all of my servers. Did you examine the difference(s) between the httpd.conf() (http://www.freebsd.org/cgi/man.cgi?....0-RELEASE+and+Ports&arch=default&format=html
files from both installs? Do you have the relevant additions for PHP within the `mime_module` section of httpd.conf? Have you added the `MultiViews` option to the `Options` section for the hostname/domain in question, in the httpd.conf?

HTH

--Chris


----------



## hac3ru (Apr 7, 2014)

As far as I can see, the httpd.conf is correct... I added MultiViews option with no success...


----------



## Chris_H (Apr 7, 2014)

hac3ru said:
			
		

> As far as I can see, the httpd.conf is correct... I added MultiViews option with no success...


OK. Assuming a _nearly_ bone stock httpd.conf, and NO includes (separate virtual-host.conf files). I assume you have

```
#***************************************************************
# PHP -- include index.php as part of your DirectoryIndex.
# add the following to your Apache configuration file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .inc
AddType application/x-httpd-php-source .phps
```
or the likes, within the `<IfModule mime_module>` section. Yes?
Now, assuming a *virtual-host*, which inherits from the *main-server* section, _doesn't_ contain, among other options

```
Options MultiViews
```
You will *need* to use the following syntax, to add `MultiViews`

```
Options +MultiViews
```
note the addition of the *+*, in the above. It is also important to insure that the `AllowOverride` stanza doesn't prevent you from using `Options MultiViews`. Either from within the Main-Server section, nor within the Virtual-Host itself.
Lastly, the log file(s) are your friend. Apache will happily inform you of any issues it has, either with your config options/choices, or, regarding client requests to the Apache server, itself. So, assuming `<domain-name>/main.php` exists. What do the logs reveal, when you attempt to put `http://<domain-name>/main` in the URL bar of your web client (browser)?
Lastly, assuming that you add these to your .conf files. You *will* be required to re-start the server, to load the/any changes.

--Chris


----------



## hac3ru (Apr 7, 2014)

I did not have 
	
	



```
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .inc
```

I have in all my virtual hosts the [/code] Options -Indexes +FollowSymLinks +MultiViews[/code]
I have added the AddType and I restarted the server. It is not working. When I check the logs for errors I see:

```
[08/Apr/2014:00:56:46 +0300] "GET /index HTTP/1.1" 404 202
```

In the /usr/local/etc/apache24/mime.types I have: 
	
	



```
application/x-httpd-php                         phtml pht php
application/x-httpd-php-source                  phps
application/x-httpd-php3                        php3
application/x-httpd-php3-preprocessed           php3p
application/x-httpd-php4                        php4
application/x-httpd-php5                        php5
```


----------



## Chris_H (Apr 8, 2014)

hac3ru said:
			
		

> I have in all my virtual hosts the
> 
> ```
> Options -Indexes +FollowSymLinks +MultiViews
> ```


THIS is the problem.
See the error?

```
[08/Apr/2014:00:56:46 +0300] "GET /index HTTP/1.1" 404 202
```
You say

```
-Indexes
```
Yet, you attempt to load /index. As your log entry:

```
[08/Apr/2014:00:56:46 +0300] "GET /index HTTP/1.1" 404 202
```
indicates.

To fix this, change

```
-Indexes
```
to

```
+Indexes
```

Problem solved. 

--Chris


----------



## hac3ru (Apr 8, 2014)

I'll try it tomorrow but indexes is used to list the files inside a directory that doesn't have an index.php file. Don't think it will solve it. Will try it tomorrow


----------



## Chris_H (Apr 8, 2014)

hac3ru said:
			
		

> I'll try it tomorrow but indexes is used to list the files inside a directory that doesn't have an index.php file. Don't think it will solve it. Will try it tomorrow


Yes, in part. But given you _specifically_ asked for index, as the log indicated. You will have to at least have a file _called_ index. Or why bother to ask for index?
You know you can also define `Indexes`, on a per-directory basis. For example:

```
/usr/local/www/somefolder
<IfModule dir_module>
	DirectoryIndex rubbish RUBBISH trash.php garbage.html nopage.xhtml poo.garbage
</IfModule>
```
Then, when choosing `http://<my-domain>/someplace` Apache will look for all the files listed within `DirectoryIndex`, and serve up the first one it finds, as the Index, if no other file was requested.
Getting a feel for how it works?

--Chris


----------



## hac3ru (Apr 8, 2014)

As I was saying, adding +Indexes did nothing. The only thing that changed is that now if the specified index pages are not present (which for me is just index.html and index.php) it will list the files in the directory....
The error occurs no matter what I try to load. I tried to load index because I was sure that there was an index.php page there. If I try to access  localhost/index it will give me a 404 - Page not found. If I access localhost/index.php it is working. Same thing for http://localhost/admin and http://localhost/admin.php. When the .php is specified, the page is loaded correctly. If it is not specified, it returns Page not found.


----------



## Chris_H (Apr 8, 2014)

OK. I've got a clearer picture of what you're getting at. Sorry.
Try adding the following:

```
RewriteEngine on
```
just beneath the `Options` stanza under the

```
<Directory ...
```
and see if that gives you your desired results. You can change `+Indexes` to `-Indexes`. 

--Chris


----------



## hac3ru (Apr 8, 2014)

```
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
```
 Is what I get when I run `service apache24 restart`
Nevermind. I loaded the mod_rewrite.so module and the error went away. Still, calling 
	
	



```
http://localhost/admin
```
 returns 404.


----------



## Chris_H (Apr 8, 2014)

OK. Perhaps I've made too many assumptions here.
Does the following line exist under `<IfModule mime_module>`?

```
TypesConfig etc/apache22/mime.types
```
Under `<Directory "/usr/local/www/working-path">`

```
Options -Indexes +Includes +FollowSymLinks +SymLinksifOwnerMatch +ExecCGI +MultiViews
```
Do you also have the following, under it?

```
MultiviewsMatch Handlers Filters
```
If not. Try and see if that get's you where you want to be. In an effort to keep this simple. I created an additional virtual-host, with only those stanzas, and get exactly what you're looking for.

--Chris


----------



## hac3ru (Apr 8, 2014)

Chris_H said:
			
		

> OK. Perhaps I've made too many assumptions here.
> Does the following line exist under `<IfModule mime_module>`?
> 
> ```
> ...



I have 
	
	



```
TypesConfig etc/apache24/mime.types
```
 but shouldn't it be 
	
	



```
/usr/local/etc/apache24/mime.types
```

I also now have:
	
	



```
Options -Indexes +Includes +FollowSymLinks +SymLinksifOwnerMatch +ExecCGI +$
    MultiViewsMatch Handlers Filters
```
Still not working......


----------



## Chris_H (Apr 8, 2014)

hac3ru said:
			
		

> Chris_H said:
> 
> 
> 
> ...


Well, if you're working from a "stock" build/install. Directories can usually be managed _relative_ to the ServerRoot;

```
ServerRoot "/usr/local"
```
So that actually makes etc/apache24/mime.types: /user/local/etc/apache24/mime.types. No?


			
				hac3ru said:
			
		

> I also now have:
> 
> 
> 
> ...


Odd. You _are_ restarting (not reloading) the server, after making these changes. Right?
Another thought; did you build Apache out of the ports tree? Or did you use pkg(8) system to install it?

--Chris


----------



## hac3ru (Apr 8, 2014)

Yeah, you're right. I am using 
	
	



```
ServerRoot "/usr/local"
```

Yes, I am restarting the apache24 server using `service apache24 restart`

If I remember it correctly, I have installed it via the ports tree.


----------



## Chris_H (Apr 8, 2014)

hac3ru said:
			
		

> Yeah, you're right. I am using
> 
> 
> 
> ...


OK. Unless you've done something out of the ordinary with the rest of your server config. We'll have to look a different direction. But a last note before we do; Assuming you have index.html, and footer.html in the root of your server. If you put `http://yourserver/index`, or `http://yourserver/footer`, in the URL bar of your browser. Do you still get a 404? Something also worth noting; you should keep your logs within your editor, so that you can monitor the request(s) being made, as they're being made. This will help you better determine what the/any cause is for experiences you expect, but aren't getting. It'll also help you determine whether your browser is caching the responses -- something you should check. In other words; it's quite possible you're _not_ getting _current_ answers, to _current_ questions. Catch my drift?  Please note; that when I speak of the requests to index, or footer, above. I talking *html*, _not_ *PHP*. That's important. I also assume, you're using a reasonably smart editor, that checks the files status it has open, on a reasonably frequent basis, and alerts you to those changes.

--Chris


----------



## hac3ru (Apr 8, 2014)

It doesn't work with test.html. I created a test.html file and I accessed http://localhost/test and it returned: 404 Not found.

In the logs, I have the time of the entry and it is current time. It's not caching, it's the current request.
I also did `tail -f /var/log/http-access_log` and I can see the request and the 404 returned to the browser.


----------



## Chris_H (Apr 8, 2014)

hac3ru said:
			
		

> It doesn't work with test.html. I created a test.html file and I accessed http://localhost/test and it returned: 404 Not found.
> 
> In the logs, I have the time of the entry and it is current time. It's not caching, it's the current request.
> I also did `tail -f /var/log/http-access_log` and I can see the request and the 404 returned to the browser.


OK. Here's a "last ditch effort". Add the following lines just above the AllowOverride stanza

```
# DO NOT ADD THE NEXT LINE UNTIL YOU HAVE TRIED THE FOLLOWING ONE FIRST
AddOutputFilter Includes html xhtml
# TRY THE FOLLOWING ONE ALONE, BEFORE ADDING THE LINE ABOVE
AddHandler type-map var
# In other words, add the one line above. But comment (#) the other
```
following the instructions above. Add both lines, but comment the first one. Then restart the server. See if that'll get it. If not, also add the other one, as well (uncomment it). then restart, and see what you get.

--Chris


----------



## hac3ru (Apr 8, 2014)

Still not working 
If I uninstall apache and make a clean install you think I'll have some more luck?


----------



## Chris_H (Apr 8, 2014)

hac3ru said:
			
		

> Still not working
> If I uninstall apache and make a clean install you think I'll have some more luck?


At this point. Given all the messing around with it. I think that's probably a wise move.
DO delete, or move all of the MODIFIED stuff out of the way, be performing a `make deinstall`, and `make config`, `make install clean`. For example; move www to www_old. You can also simply delete all the etc/apache24/* stuff. That way, you can be sure that you actually ARE getting a nice new fresh install. 
Lemme know when you've finished the install, but _before_ you start, or edit anything. 

--Chris


----------



## hac3ru (Apr 8, 2014)

Okay so I deinstalled apache24, deleted /usr/local/etc/apache24 folder and I have moved /usr/local/www/ to my home folder. Installing apache now. I need the php module loaded and mysqli + hiding extension for php. What should I modify?


----------



## Chris_H (Apr 9, 2014)

hac3ru said:
			
		

> Okay so I deinstalled apache24, deleted /usr/local/etc/apache24 folder and I have moved /usr/local/www/ to my home folder. Installing apache now. I need the php module loaded and mysqli + hiding extension for php. What should I modify?


Forgot about PHP. You'll probably need to deinstall the PHP module before you deinstall www/apache2*. But, as long as you don't also deinstall PHP (no point, really), the mysql, and mysql lib for PHP, should not be an issue (don't worry about them). 

--Chris


----------



## Chris_H (Apr 9, 2014)

I guess, when your done. The best plan should be to copy etc/apache2(2|4)/httpd.conf to etc/apache2(2|4)/httpd.conf.ORG, and etc/apache2(2|4)/extra/httpd-default.conf to etc/apache2(2|4)/extra/httpd-default.conf.ORG. That way, you'll have virgin copies to roll back to, in the future. Should you ever have to. This gives you (us) free reign, to do whatever. Without concern. I gotta tell you tho. I've been doing this for ~20yrs, and manage some 120 domains, with even more hosts, and this one's been _really_ odd.

OK. Then, lemme know when yer ready. I'll be in, and out. But, will keep an eye on the thread. 

--Chris


----------



## hac3ru (Apr 9, 2014)

I did backed up those files because I had to use the server the night that just passed. I backed up the configs and I have edited the settings so that people will be able to use the server this 12hours+.

I did not deinstall php module. Do you think that it will be a problem?


----------



## Chris_H (Apr 9, 2014)

hac3ru said:
			
		

> I did backed up those files because I had to use the server the night that just passed. I backed up the configs and I have edited the settings so that people will be able to use the server this 12hours+.


Sure. Understood. Good thinking. 


			
				hac3ru said:
			
		

> I did not deinstall php module. Do you think that it will be a problem?


Probably not an issue. Have you tested php(1), to see if it works with Apache, as expected? Maybe something like creating the file phpinfo.php in the root of your server, containing:

```
<?php
phpinfo();
?>
```
then following the link: `http://yourserver/phpinfo.php`, or better; `http://yourserver/phpinfo` -- assuming there is no longer a need to provide the extension. 

--Chris


----------



## hac3ru (Apr 9, 2014)

I tried that. The php works but accessing files without specifying the extension is not working.


----------



## Chris_H (Apr 9, 2014)

hac3ru said:
			
		

> I tried that. The php works but accessing files without specifying the extension is not working.


Figures. 
OK. Assuming the usual boatload of Apache extensions were installed, and you have, at least, most of them enabled. Let's try a simple virtual-host config
Assuming you have the following 2 includes in your /usr/local/etc/apache24/httpd.conf file, and you have *NOT* modified either of them

```
# Various default settings
Include etc/apache22/extra/httpd-default.conf
# Virtual hosts
Include etc/apache22/extra/httpd-vhosts.conf
```
add the following to the bottom of /usr/local/etc/apache24/extra/httpd-vhosts.conf

```
<VirtualHost *:9000>
    ServerAdmin nobody@localhost
    DocumentRoot "/usr/local/www/localtest"
    ServerName localhost
RewriteEngine on
<Directory "/usr/local/www/localtest">
# we're going to allow the whole gambit here -- it's only a test
	Options +Indexes +Includes +FollowSymLinks +SymLinksifOwnerMatch +ExecCGI +MultiViews
MultiviewsMatch Handlers Filters

	AllowOverride None
	Order allow,deny
	Allow from all
</Directory>
<IfModule dir_module>
	DirectoryIndex INDEX index.php index.html index.xhtml
</IfModule>
    ErrorLog "/var/log/www/Localtest-error.log"
    CustomLog "/var/log/www/Localtest-access.log" combined
</VirtualHost>
```
Also, does the following appear in your /usr/local/etc/apache24/httpd.conf file?

```
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig etc/apache22/mime.types
```
Let's start there, and see what the results are. Keeping it simple -- the less variables, the easier it is to isolate the issue.
DO make sure the directory exists (you created it) for our test virtual-host, and that the server (Apache) can read from it.

--Chris

*OH!* I forgot to mention; you will also need to add

```
Listen 9000
```
just after

```
Listen 80
```
near the top of your /usr/local/etc/apache24/httpd.conf file.


----------



## hac3ru (Apr 9, 2014)

I added `Listen 9000` and when I try to access http://server_ip:9000 I get 
	
	



```
Forbidden

You don't have permission to access / on this server.
```

Nevermind. I fixed that but accessing http://server_ip:9000/index returns Error 404, while http://server_ip:9000/index.html returns the page


----------



## Chris_H (Apr 9, 2014)

Did you catch my addition to the bottom of my last reply?


```
Listen 9000
```
just after

```
Listen 80
```
near the top of your /usr/local/etc/apache24/httpd.conf file.

Also, you _did_ create the directory. /usr/local/www/localtest right?
are there any files in to? does Apache have read access to the folder? Check the permissions.

--Chris


----------



## Chris_H (Apr 9, 2014)

OK ignore my last comments. I'll port a reply to your last (additions).


----------



## Chris_H (Apr 9, 2014)

OK. A couple of things here. The fact that you had to use the specific address indicates address resolution issues. localhost should be easily accessible, w/o issue; either by way of: `http://localhost`, or by `http://127.0.0.1`. I used the port 9000 to differentiate the use of a different directory. Maybe that's going to pose an issue in your case. but shouldn't. Just to confirm. Let's do the following; Since Directory Listings are enabled for this virtual-host, remove all the files listed as Indexes (index.html ...). then add an odd named file, that you _know_ doesn't exist in _any_ of your other virtual-hosts. Let's call it A-TEST, no extension. Then re-start the server, and go to it's root, and see if it shows up in the directory listing. Lemme know what you find.

--Chris


----------



## hac3ru (Apr 9, 2014)

The server is running on a FreeBSD, that's why I'm using the server's IP address.
Will try that now and I'll be back with the results.

Removing the INDEXES will show me the files in the localtest directory when accessing 
	
	



```
http://server_ip:9000
```


----------



## Chris_H (Apr 9, 2014)

hac3ru said:
			
		

> The server is running on a FreeBSD, that's why I'm using the server's IP address.
> Will try that now and I'll be back with the results.


Hmm. Not sure I follow you here. The development box I'm writing this from, has 3 virtual-hosts running from 3 different directories, all on `localhost`. The only difference, is that they all use different ports. So, should devlocal1 be on port 9191, in directory www/devlocal1. I go to `http://devlocal1:9191` to get there. Same for devlocal2. If it were on port 8585, in directory devlocal2, I'd do the same; `http://devlocal2:8585`. In all cases, no IP address is required. I _too_ am on FreeBSD. 


			
				hac3ru said:
			
		

> Removing the INDEXES will show me the files in the localtest directory when accessing
> 
> 
> 
> ...



I'll keep monitoring. 

--Chris


----------



## hac3ru (Apr 9, 2014)

I'm not sure I follow. How does devlocal1 translates into the IP address? The computers communicate using the IP and the MAC address so any name is translated into an IP address. How does your system do that?
Anyway, setting virtual hosts with ServerName and ServerAlias gets me to the same result as you. I now have two virtualhosts that I access using http://site1.home.ro and http://site2.home.ro. Both on the same FreeBSD machine. I have used dnsmasq to resolve those names though.


----------



## Chris_H (Apr 9, 2014)

OK. Just for clarification. I manage a /27 here locally. On this box, I have one internet facing address assigned, and serve some 62 virtual-hosts assigned to that address. For local development, I use `localhost`. I can then be assured that no one but me, can access any of the virtual-hosts I serve from it. It matters not _what_ hostname(1) I use to describe the virtual-host. So, if Apache is used, I declare the following, in the conf file(s)

```
<VirtualHost *:8585>
    ServerAdmin nobody@localhost
    DocumentRoot "/usr/local/www/devlocal2"
    ServerName localhost
#I only use the following, in rare cases. But appears necessary for you
ServerAlias devlocal2
```
For whatever reason. I'm able to get there by name, so long as I use the correct port. Such seems not the case for you.
You can also use your hosts(5) file, for host resolution. Probably much easier, and quicker than dnsmasq(8).

OK. Well if you have the localhost virtual-hosts working. When you deleted the INDEXES, and saw the directory listing. Was the oddly named file present?

--Chris


----------



## Chris_H (Apr 9, 2014)

Lastly, what is the listing of modules you have in your /usr/local/etc/apache24/httpd.conf file?
eg;

```
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module libexec/apache22/mod_authn_file.so
...
```

Reason being. You'll need to several modules present (and active) for your desired outcome to be accomplished. I need to know if they are. Since you seem to indicate you're not getting your desired results.

--Chris


----------



## hac3ru (Apr 9, 2014)

This is from httpd.conf

```
LoadModule authn_file_module libexec/apache24/mod_authn_file.so
#LoadModule authn_dbm_module libexec/apache24/mod_authn_dbm.so
#LoadModule authn_anon_module libexec/apache24/mod_authn_anon.so
#LoadModule authn_dbd_module libexec/apache24/mod_authn_dbd.so
#LoadModule authn_socache_module libexec/apache24/mod_authn_socache.so
LoadModule authn_core_module libexec/apache24/mod_authn_core.so
LoadModule authz_host_module libexec/apache24/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache24/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache24/mod_authz_user.so
#LoadModule authz_dbm_module libexec/apache24/mod_authz_dbm.so
#LoadModule authz_owner_module libexec/apache24/mod_authz_owner.so
#LoadModule authz_dbd_module libexec/apache24/mod_authz_dbd.so
LoadModule authz_core_module libexec/apache24/mod_authz_core.so
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
LoadModule auth_basic_module libexec/apache24/mod_auth_basic.so
#LoadModule auth_form_module libexec/apache24/mod_auth_form.so
#LoadModule auth_digest_module libexec/apache24/mod_auth_digest.so
#LoadModule allowmethods_module libexec/apache24/mod_allowmethods.so
#LoadModule file_cache_module libexec/apache24/mod_file_cache.so
#LoadModule cache_module libexec/apache24/mod_cache.so
#LoadModule cache_disk_module libexec/apache24/mod_cache_disk.so
#LoadModule cache_socache_module libexec/apache24/mod_cache_socache.so
#LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
#LoadModule socache_dbm_module libexec/apache24/mod_socache_dbm.so
#LoadModule socache_memcache_module libexec/apache24/mod_socache_memcache.so
#LoadModule macro_module libexec/apache24/mod_macro.so
#LoadModule dbd_module libexec/apache24/mod_dbd.so
#LoadModule dumpio_module libexec/apache24/mod_dumpio.so
#LoadModule buffer_module libexec/apache24/mod_buffer.so
#LoadModule ratelimit_module libexec/apache24/mod_ratelimit.so
LoadModule reqtimeout_module libexec/apache24/mod_reqtimeout.so
#LoadModule ext_filter_module libexec/apache24/mod_ext_filter.so
#LoadModule request_module libexec/apache24/mod_request.so
#LoadModule include_module libexec/apache24/mod_include.so
LoadModule filter_module libexec/apache24/mod_filter.so
#LoadModule substitute_module libexec/apache24/mod_substitute.so
#LoadModule sed_module libexec/apache24/mod_sed.so
#LoadModule deflate_module libexec/apache24/mod_deflate.so
LoadModule mime_module libexec/apache24/mod_mime.so
LoadModule log_config_module libexec/apache24/mod_log_config.so
#LoadModule log_debug_module libexec/apache24/mod_log_debug.so
#LoadModule logio_module libexec/apache24/mod_logio.so
LoadModule env_module libexec/apache24/mod_env.so
#LoadModule mime_magic_module libexec/apache24/mod_mime_magic.so
#LoadModule cern_meta_module libexec/apache24/mod_cern_meta.so
#LoadModule expires_module libexec/apache24/mod_expires.so
LoadModule headers_module libexec/apache24/mod_headers.so
#LoadModule unique_id_module libexec/apache24/mod_unique_id.so
LoadModule setenvif_module libexec/apache24/mod_setenvif.so
LoadModule version_module libexec/apache24/mod_version.so
#LoadModule remoteip_module libexec/apache24/mod_remoteip.so
#LoadModule proxy_module libexec/apache24/mod_proxy.so
#LoadModule proxy_connect_module libexec/apache24/mod_proxy_connect.so
#LoadModule proxy_ftp_module libexec/apache24/mod_proxy_ftp.so
#LoadModule proxy_http_module libexec/apache24/mod_proxy_http.so
#LoadModule proxy_fcgi_module libexec/apache24/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module libexec/apache24/mod_proxy_scgi.so
#LoadModule proxy_wstunnel_module libexec/apache24/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module libexec/apache24/mod_proxy_ajp.so
#LoadModule proxy_balancer_module libexec/apache24/mod_proxy_balancer.so
#LoadModule proxy_express_module libexec/apache24/mod_proxy_express.so
#LoadModule session_module libexec/apache24/mod_session.so
#LoadModule session_cookie_module libexec/apache24/mod_session_cookie.so
#LoadModule session_crypto_module libexec/apache24/mod_session_crypto.so
#LoadModule ssl_module libexec/apache24/mod_ssl.so
#LoadModule lbmethod_byrequests_module libexec/apache24/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module libexec/apache24/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module libexec/apache24/mod_lbmethod_bybusyness.so
LoadModule unixd_module libexec/apache24/mod_unixd.so
#LoadModule dav_module libexec/apache24/mod_dav.so
LoadModule status_module libexec/apache24/mod_status.so
LoadModule autoindex_module libexec/apache24/mod_autoindex.so
#LoadModule asis_module libexec/apache24/mod_asis.so
#LoadModule info_module libexec/apache24/mod_info.so
LoadModule cgi_module libexec/apache24/mod_cgi.so
#LoadModule cgid_module libexec/apache24/mod_cgid.so
#LoadModule dav_fs_module libexec/apache24/mod_dav_fs.so
#LoadModule vhost_alias_module libexec/apache24/mod_vhost_alias.so
#LoadModule negotiation_module libexec/apache24/mod_negotiation.so
LoadModule dir_module libexec/apache24/mod_dir.so
#LoadModule imagemap_module libexec/apache24/mod_imagemap.so
#LoadModule actions_module libexec/apache24/mod_actions.so
#LoadModule speling_module libexec/apache24/mod_speling.so
#LoadModule userdir_module libexec/apache24/mod_userdir.so
LoadModule alias_module libexec/apache24/mod_alias.so
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
LoadModule php5_module /usr/local/libexec/apache24/libphp5.so
```


----------



## Chris_H (Apr 9, 2014)

OK. This is a quickie. UNcomment the following; I'll justify their purpose when I get a chance.
After you've uncommented them. restart the server. I think you'll find everything works, as you had intended. 


```
#LoadModule allowmethods_module libexec/apache24/mod_allowmethods.so

#LoadModule macro_module libexec/apache24/mod_macro.so

#LoadModule request_module libexec/apache24/mod_request.so
#LoadModule include_module libexec/apache24/mod_include.so

#LoadModule mime_magic_module libexec/apache24/mod_mime_magic.so

#LoadModule cern_meta_module libexec/apache24/mod_cern_meta.so
#LoadModule expires_module libexec/apache24/mod_expires.so

#LoadModule asis_module libexec/apache24/mod_asis.so
#LoadModule info_module libexec/apache24/mod_info.so

#LoadModule vhost_alias_module libexec/apache24/mod_vhost_alias.so
#LoadModule negotiation_module libexec/apache24/mod_negotiation.so

#LoadModule actions_module libexec/apache24/mod_actions.so
```

--Chris


----------



## Chris_H (Apr 9, 2014)

Further elaboration on your dis-abled modules:

```
#LoadModule allowmethods_module libexec/apache24/mod_allowmethods.so
Controls Allow Deny stanza
#LoadModule macro_module libexec/apache24/mod_macro.so
Allows to make complex re-write, or other complicated declarations as simple Name

#LoadModule request_module libexec/apache24/mod_request.so
Gives acces to REQUEST methods -- PUT GET DELETE, ... and allows to Permit, or modify reply
#LoadModule include_module libexec/apache24/mod_include.so
Provides for Includes stanza

#LoadModule mime_magic_module libexec/apache24/mod_mime_magic.so
Allows more fine-grained handling of MimeTypes

#LoadModule cern_meta_module libexec/apache24/mod_cern_meta.so
Somewhat legacy, but usually kept as "standard" on Apache installs
#LoadModule expires_module libexec/apache24/mod_expires.so
Permite defining "lifetime" of files served, important for Proxies, Search engines, and Dynamic Content

#LoadModule asis_module libexec/apache24/mod_asis.so
Allows to SEND file "as-is" -- intuitive. No?
#LoadModule info_module libexec/apache24/mod_info.so
Permits, among other things, monitoring your server; see httpd.conf file, for details

#LoadModule vhost_alias_module libexec/apache24/mod_vhost_alias.so
Almost a no-brainer, when serving virtual-hosts
#LoadModule negotiation_module libexec/apache24/mod_negotiation.so
Allows serving the "correct" mime-type to clients, and helps Apache make the best choice

#LoadModule actions_module libexec/apache24/mod_actions.so
sort of an, action::reaction module. permits doing "something", when "something" occurs
```

I would've looked here earlier. But most of the modules I mentioned here, have been default-on on most every server install, most people perform. So, to me, it seemed quite unlikely that any of these wouldn't already be ENabled. It's also interesting that you never received any error(s) in any of your log files, regarding the attempt to use those module' capabilities. For example; the Allow, and Deny stanza's aren't even possible w/o the mod_allowmethods.so.

Oh, well. If you enabled them. I can pretty well be rest assured that you're getting what you were attempting.

--Chris


----------



## hac3ru (Apr 10, 2014)

I added those modules, did 
	
	



```
service apache24 restart
```
 and I tried. No luck... I think that a hammer will fix it


----------



## Chris_H (Apr 10, 2014)

Ug. Well, I've been doing this since before Apache was officially _Apache_. At this point, I can only conclude that there's something in your httpd.conf, or other config file, that preempts what we've done to enable the functionality you're seeking. I've got a fresh installation coming up in the next couple days. When I've completed it. I'll make a dump of the config files here. For you to compare against, or use for your own. All the servers I currently manage, have extremely large, and complicated configurations. That would only overwhelm, not serve you. 

--Chris


----------



## hac3ru (Apr 10, 2014)

Okay mate. Thank you. I'll keep checking this thread and when you'll post that config, I'll be here 

Thank you again.


----------



## Chris_H (May 7, 2014)

Hello, @hac3ru.
Sorry for the delay.
Assuming you already have the following, or similar defined

```
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .inc
AddType application/x-httpd-php-source .phps
```
 I think all you'll need is the following

```
MultiviewsMatch Handlers Filters
# for Perl/cgi
#    AddHandler cgi-script cgi
#    AddHandler cgi-script pl
# for php
AddHandler php-script php
AddHandler php5-script php
```
I may be wrong regarding the application/x-http-php part, it might be slightly different. But the AddHandler, performs the magic. I'd have been able to confirm, by testing it. But I don't use php. it's a huge security risk. I have too much to do already, to have to join the patch-of-the-month club. Frankly, I don't care for Apache, for the same reason. They'd both be great, if they could just just figure out how to code, without leaving security holes. At this point, it's almost like exploit _features_. After 20 years, you'd think Apache would have _finally_ figured it out. 
As to the AddType / AddHandler; a little history is in order. Back in the Apache-1.x days, AddType was all that was needed to accomplish what you were looking to achieve. In fact, I'll bet php.net still lists that, as the correct way to do it (they're wrong). But when Apache-2.x came out, all of that changed, and they added AddHandler. AddHandler is the method for the _Server_, and AddType remains, for the _Client_ -- AddHandler tells Apache what to do with the extension, and AddType tells the Browser what to do with an extension.
So I could name all my files with the .trojan extension, and add

```
AddType   text/html trojan
```
and your web browser would treat bad.trojan, and index.trojan like a regular html file. 

Well, best wishes to you, @hac3ru. Let me know how it works out for you.

OH, _do_ note above;
the MultiviewsMatch Handlers Filters stanza is important. So don't forget it. Probably the best place to put all the above, is right below the Options stanza. eg;

```
Options +Indexes +Includes ...
    MultiviewsMatch Handlers Filters
    AddHandler trojan-script trojan
    AddHandler php-script php php4
    AddHandler php5-script php phtml php5
```
Anyway, you get the idea. 

--Chris


----------



## hac3ru (May 7, 2014)

Hello,

Thank you for this. I'll try it, this week hopefully, when I'll get to that server. I'll be back with a reply.
Thank you again.


----------

