# FreeBSD has two different versions of PHP



## albertguedes (Jul 2, 2014)

Hi,

I have a VPS server with FreeBSD 9.1 and Apache 2.2.24. But on this server the PHP on the command line is 5.4.29 and the PHP running on Apache is 5.2.17 and this causes many problems for my projects, because I need 5.4 or greater on Apache. What do I do to let Apache run PHP 5.4?


----------



## pettijohne (Jul 3, 2014)

Are you using mod_php or php-fpm?


----------



## albertguedes (Jul 4, 2014)

mod_php.


----------



## junovitch@ (Jul 5, 2014)

Last I checked, PHP 5.4 should be the default version. It's hard to say based off what you provided. Maybe the PHP 5.2 was installed outside of ports. Maybe ports were installed at different times. Maybe there is a default version set in your /etc/make.conf.  I would suggest just force a re-install of the trio by doing something like `pkg install -f apache22 php5 mod_php5`.  Alternately, remove any default version from /etc/make.conf if you are fine with version 5.4 and re-install using ports if you prefer. That way you know for sure everything matches up.


----------



## Melvyn (Jul 6, 2014)

```
% pkg updating -d 20140327 lang/php5
20140327:
  AFFECTS: users of lang/php5 and lang/php55 with Apache module
  AUTHOR: ale@FreeBSD.org

  The Apache PHP module has been separated from the main PHP port.
  If you had the APACHE OPTION selected, you have to perform the
  following steps:

  1) update your lang/php* options (i.e. 'make config')
  2) rebuild lang/php* port
  3) install www/mod_php* port

  It is *mandatory* to build both ports with the same DEBUG and ZTS
  options, so if you have a threaded Apache (i.e. worker or event MPM)
  you have to select the ZTS option in lang/php* port.
```


----------



## albertguedes (Jul 8, 2014)

I reinstall '/usr/ports/lang/php5' , '/usr/ports/www/mod_php5' and '/usr/ports/www/apache24'. Its all ok. 

The problem now is that i point 


```
LoadModule	php5_module 		/usr/local/libexec/apache24/libphp5.so
```

in "/etc/httpd/conf/extra/httpd-phpaddmodules.conf" file, i restart the "httpd"

`$ service httpd restart`

and its give the error


```
httpd: Syntax error on line 18 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf/extra/httpd-phpmodules.conf: Cannot load /usr/local/libexec/apache24/libphp5.so into server: /usr/local/libexec/apache24/libphp5.so: Undefined symbol "ap_unixd_config"
```

I dont know how to solve it, if apache and php are all upgraded and theoretically this erro only occurs with apache 22


----------



## albertguedes (Jul 13, 2014)

I find the solution : install apache 5.4

My current apache is 5.2 version.


----------

