# FreeBSD 9.2 64 bits Error for install PHP5 and Extension



## Elijah (Oct 3, 2014)

Hi 
I contact you because I need help for install Apache / php5 and php5 extension for a dedicated server FreeBSD 9.2 64 bits.
Now It's difficult because Use pkg() command.

First question, how install Apache, PHP5 and extensions with pkg()? Because I need `make config` for put config apache ... and extension.

For install MySQL it's good, it's just: `pkg-config mysql55-server`

After I have tested new solution for use `make install clean`...

With this:


```
1. pkg update	
2. pkg upgrade (Y)	
3. go /usr/local/etc/ and Delete pkg.conf	
4. pkg_add -r portupgrade	
5. /usr/local/sbin/portupgrade -a
```

For install apache it's ok with:

```
cd /usr/ports/www/apache22
make config
make install
```
But after for install php5  :


```
root@ns385667:/usr/ports/www/apache22 # cd /usr/ports/www/mod_php55
root@ns385667:/usr/ports/www/mod_php55 # make config
```

With `make config` it's good. But for make install clean I have little error:


```
root@ns385667:/usr/ports/www/mod_php55 # make install clean
===>  mod_php55-5.5.17_1 is marked as broken: : Error from bsd.apache.mk. apache22 is installed (or APACHE_PORT is defined) and port requires apache.
*** [install] Error code 1
```
You are solution?


----------



## talsamon (Oct 3, 2014)

The first I see is you use `pkg_add` - is deprecated - use `pkg add`.

Do you have:

```
DEFAULT_VERSIONS=apache=2.2
```
in your /etc/make.conf?


----------



## Elijah (Oct 3, 2014)

Thanks IT's work


----------



## Elijah (Oct 3, 2014)

Mmmmmh.

Now, I have a problem : URL removed

My PHP doesn't work.  But I have all, I've put the line in: httpd.conf.  And generate the php.ini.  But doesn't work.

How install with pkg?


----------



## talsamon (Oct 3, 2014)

The (one ?) line?

All this lines are there?


```
LoadModule php5_module        libexec/apache22/libphp5.so
```


```
<IfModule dir_module>
    DirectoryIndex index.html index.php index.sh default.jsp
</IfModule>
```


```
AddType application/x-httpd-php .php .phtml .php3 .php4 .php5 .php6 .html
    AddType application/x-httpd-php-source .phps
    AddHandler php5-script php
    AddType application/x-httpd-php .xml
    AddHandler application/x-httpd-php .xml
```


```
<IfModule mod_php5.c>
  php_value include_path ".:/usr/local/lib/php"
  php_admin_flag safe_mode on
</IfModule>
```


----------



## Elijah (Oct 3, 2014)

I put to: httpd.conf?
You are skype ? ^^


----------



## talsamon (Oct 3, 2014)

I have no skype, you can mail questions. Yes in the  httpd.conf.
But read the file careful, maybe they are already there.


----------



## Elijah (Oct 4, 2014)

Mmmmh don't work  

It's possible give me a full tutorial for installing Apache/PHP5/extension with FreeBSD? (pkg)
Thanks ^^


----------



## talsamon (Oct 4, 2014)

Don't work is a little bit less. Any error messages ? Starts apache if you run `apachectl -k  onestart` ? Is mod_session installed (www/php5-session).

(Put later `apache22_enable="YES"` in your /etc/rc.conf).

Uncomment the line 
	
	



```
DocumentRoot "/usr/local/www/apache22/data"
```
 in httpd.conf.

Look in /usr/local/etc/php/extensions.ini - if there are double-listed modules. If there are doubles delete one.

Do you have a phpinfo.php ? If not create on in Document-Root with only 


```
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
```
in it. So you can check if `php` works.

One thing, I can't answer you - a apache-tutorial, I think someone other has an answer, I never found a good.


----------



## Elijah (Oct 4, 2014)

OK ^^

I reinstall my dedicated server FreeBSD 9.2. My tutorial:

*1) For mysql work, I put this command :* 
`pwd_mkdb /etc/master.passwd`

*2) Portsnap :*
`portsnap fetch extract`

*3) Apache 22 or 24 ? the best ?*
`pkg_add -rv apache22`
I put this to  /etc/rc.conf:

```
# Apache 2.4
apache24_enable="YES"
apache24_flags="-DSSL" # Active le support de SSL
```

And to http.conf:

*Ajoutez à /usr/local/etc/apache22/httpd.conf ou créez /usr/local/etc/apache22/Includes/php.conf tel que :*


```
<IfModule php5_module>
        <FilesMatch "\.php$">
            SetHandler application/x-httpd-php
        </FilesMatch>
    </IfModule>
```

*   Trouver et remplacer dans /usr/local/etc/apache22/httpd.conf afin d'ajouter index.php comme nom des pages de répertoire par défaut :*


```
<IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>
```

*  Par :*


```
<IfModule dir_module>
        <IfModule php5_module>
            DirectoryIndex index.php index.html
        </IfModule>
        <IfModule !php5_module>
            DirectoryIndex index.html
        </IfModule>
    </IfModule>
```

*In make.conf: *

```
DEFAULT_VERSIONS=apache=2.2
```

*4) PHP5*
`pkg_add -rv php5`
*But The problem here, how config PHP5 for Apache?*

*Other command?*

*5) PHP5 extension:*
*Command? and add extension mbstring ...*

*6) generate php.ini*
`cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini`
*
Please Help me 
2 day, I need install Apache, PHP5 and extension ...
Thanks.*


----------



## talsamon (Oct 4, 2014)

You cannot write in the /etc/rc.conf: 
	
	



```
apache24
```
 and in the /etc/make.conf

```
apache=2.2
```
, it should the version you have installed.

By the way I think it's better you install apache24, it's the default-version (In this case, you don't need the line in /etc/make.conf)

extension mbstring : install converters/php5-mbstring  sometimes you had add a line to /usr/local/etc/php/extensions.ini: 
	
	



```
extension=mbstring.so
```


----------



## Elijah (Oct 4, 2014)

Thanks and for install php5and php5-extension. The command it's what ?


----------



## talsamon (Oct 4, 2014)

Either in the ports - lang/php5 and lang/php5-extensions or with `pkg install php5 php5-extensions.`

If you install apache24 the php-versions must be 55.


----------

