# Apache2.2.21 + mod_cgi + php rendering problem



## jurgn (Mar 3, 2012)

The Apache configuration doesn't support DSO. When I request files with the postfix .html a dialogue box appears for either saving or opening the file. When it is a PHP script that I request the PHP tags are ignored and the code is rendered as plain text.

I have added and removed the media type;

```
AddType applicatioon/x-htttpd-php .php
```
 and 

```
AddType applciation/x-httpd-source .phps
```

Added and removed these handlers:

```
AddHandler cgi-scrpt .cgi
```


```
AddHanler php-script .php
```

And also added in the Options directive 
	
	



```
Options ExecCGI
```

Leaving these directive in part or in whole doesn't change anything, a dialogue box on html tags, when removed the PHP script is displayed as plain text.
I don't know how to solve the issue. Can anyone help?


----------



## SirDice (Mar 3, 2012)

jurgn said:
			
		

> I have added and removed the media type;
> 
> ```
> AddType applicatioon/x-htttpd-php .php
> ```


There's one T and one O too many in there.



> ```
> AddHanler php-script .php
> ```


There's a D missing.


----------



## jurgn (Mar 4, 2012)

SirDice, 

Thanks for pointing this out, but the httpd.config file has the correct syntax and spelling and apache2.2.17_1 is still mute.

Both Apache and PHP5 have been downloaded from a package version 8.2 release.

The version running on my computer is version 8.1 release, the reason is that I kept getting a libutil.so.9 needed by perl from ld-elf.so.1 while installing Apache2.2_17 downloaded from the ftp-archives

I don't know what to do next. Any advice short of upgrading to another package version?

May be has it anything to do with the sequence of the installations? 
I did first install PHP5 extensions, then MySQL and finally Apache..


----------



## DutchDaemon (Mar 5, 2012)

The PHP package does not contain the Apache module. You must build lang/php5 and choose the option to build the Apache module.


```
APACHE=[B]off[/B] ([B]default[/B]) "Build Apache module"
```


----------



## jurgn (Mar 6, 2012)

Hello DutchDaemon, thank you for replying.

I don't know how to do that from packages installed with the [cmd=]pkg_add -r apache-2-2.17_1[/cmd] directive. 

That version doesn't support "dso" modules, nor "fcgi", it only supports, it seems, "mod_cgi". 

I have re-installed it, but still the same problem, php code is plain text,seems that I am in for a downgrade.

An earlier version worked really well, no compatibility problem nor any of the nefarious 
	
	



```
/libexec/ld-elf.so.1
```


```
could not find "libutil.so.9" needed by "perl"
```
 A configuration file issue maybe?


----------



## SirDice (Mar 6, 2012)

You need to build lang/php5 from ports if you want the Apache module. The package does NOT contain it.

If you want some of the other Apache modules you'll have to build www/apache22 from the port too.


----------



## jurgn (Mar 6, 2012)

SirDice, there is no way then, to synchronise php with mod_cgi?


----------

