# Trouble installing PHP



## lfloyd (Feb 22, 2011)

I'm having difficulty installing PHP on a fresh installation of FreeBSD 8.1.  I pointed sysinstall to the FreeBSD ftp site, which resulted in this (via pkg_version -v):


```
php5-5.3.2_1                        =   up-to-date with port
php5-ctype-5.3.2_1                  =   up-to-date with port
php5-dom-5.3.2_1                    =   up-to-date with port
php5-extensions-1.4                 =   up-to-date with port
php5-filter-5.3.2_1                 =   up-to-date with port
php5-hash-5.3.2_1                   =   up-to-date with port
php5-iconv-5.3.2_1                  =   up-to-date with port
php5-json-5.3.2_1                   =   up-to-date with port
php5-pdo-5.3.2_1                    =   up-to-date with port
php5-pdo_sqlite-5.3.2_1             =   up-to-date with port
php5-posix-5.3.2_1                  =   up-to-date with port
php5-session-5.3.2_1                =   up-to-date with port
php5-simplexml-5.3.2_1              =   up-to-date with port
php5-sqlite-5.3.2_1                 =   up-to-date with port
php5-tokenizer-5.3.2_1              =   up-to-date with port
php5-xml-5.3.2_1                    =   up-to-date with port
php5-xmlreader-5.3.2_1              =   up-to-date with port
php5-xmlwriter-5.3.2_1              =   up-to-date with port
php_doc-en-20100701_1               =   up-to-date with port
```

And I updated httpd.conf with:


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

And I restarted Apache.  But no joy.

What am I missing?

Thanks.

- Larry


----------



## fernando (Feb 22, 2011)

Are you trying to setup an Apache 2.x with PHP5? If so, try:

Add this inhttpd.conf


```
LoadModule php5_module        libexec/apache/libphp5.so
DirectoryIndex [B]index.php[/B] index.html index.htm
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
```

Now, run the command below:


```
# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
```

Restarting Apache daemon and try again.


----------



## lfloyd (Feb 22, 2011)

Yes, this is PHP 5.3.2 with Apache 2 on FreeBSD 8.1.

Interesting... I'm finding a bunch of PHP .so files here:


```
/usr/local/lib/php/20090626/
```

and here:


```
/usr/local/libexec/apache22/
```

But I don't see libphp5.so in either of those locations.

I made those other edits and restarte Apache, but still no serving up of .php files (just shows the content, including what is between the PHP tags).

I don't recall this being so difficult in the past... I must be spacing out on something?

- larry


----------



## kpedersen (Feb 22, 2011)

The PHP package does not come with the apache module.

You either have to compile and install the port (select apache module from the options)

Or you can use the php-cgi with apache (slower)


----------



## lfloyd (Feb 22, 2011)

Okay, I downloaded the distribution tar ball.  Did:

`# # make config`

and selected the Apache module (I think that was the ONLY option I selected).  Then:

`# # make install`

At which point "lots of things happened", but in the end, the installation looked good.  I restarted Apache and pointed Chrome to a phpinfo(); page.  All Chrome wanted to do was download the PHP file.  Hmmmm.... I checked to see if the right AddType directives were in httpd.conf and they were (the installation made the changes).  Just as I was about to give up, I thought I'd try another browser (I was testing on a Windoze box).  As it turns out, Chrome was nuts (or at least that session was), because IE and another session of Chrome loaded it just fine.

Thanks for the help!

- Larry


----------

