# Forcing PHP 5.4



## InvaderZim (Mar 11, 2015)

We've got freshly installed servers running FreeBSD 10.1-RELEASE.

We want to install various things for use with PHP 5.4. But since the change to making 5.6 the default we've been running into problems.

/etc/make.conf

```
WITH_PKGNG=YES
DEFAULT_PHP_VER= 5
DEFAULT_VERSIONS=apache=2.4 php=5.4 mysql=5.5
```
And PHP 5.4 is installed. But when we want to install, say, databases/phpmyadmin or databases/pecl-memcached pkg wants to install PHP 5.6. I would like to know why, but more importantly, I'd like to know how to tell pkg not to do this and stick with what I want, PHP 5.4.


----------



## ljboiler (Mar 12, 2015)

The dependency of the phpmyadmin on php 5.6 when installed by `pkg` is not controlled by any DEFAULT_VERSIONS you have in your local /etc/make.conf file, but by what the DEFAULT_VERSIONS is set to on the big server that builds all those packages and puts them in the big FreeBSD pkg repository.  To use your own DEFAULT_VERSIONS, you'll have to build the port(s) yourself on your local machine.


----------



## SirDice (Mar 12, 2015)

Package dependencies are set and cannot be changed. If you need to deviate from the default you will have to build the port.


InvaderZim said:


> /etc/make.conf
> 
> ```
> WITH_PKGNG=YES
> ```


You can remove this, it's the default on 10.x. 



> ```
> DEFAULT_PHP_VER= 5
> ```


This variable is not supposed to be used in make.conf. It's used by ports. 



> ```
> DEFAULT_VERSIONS=apache=2.4 php=5.4 mysql=5.5
> ```


These are good but only have effect when building from ports, it does nothing for packages.

If you have more than one server I highly recommend setting up ports-mgmt/poudriere and building your own repository. That way you can change all the settings you want while keeping the benefit of packages. The "build" server doesn't have to be big or powerful. I usually build a new package repository once a month unless there's a security issue in one of the ports. It takes about an hour to build a complete repository with everything we need and with all the default settings we want.


----------



## InvaderZim (Mar 12, 2015)

ljboiler Thank you for your reply, but we tried that (something I didn't mention because maybe we did that wrong and the "official" fix was something completely different. Then we ran into this sh!t:

```
Installing gettext-0.18.3.1_1...
pkg-static: gettext-0.18.3.1_1 conflicts with gettext-tools-0.19.4 (installs files into the same place).  Problematic file: /usr/local/bin/autopoint
```

And when we "fixed" that, it was followed by

```
Installing gettext-0.18.3.1_1...
pkg-static: gettext-0.18.3.1_1 conflicts with gettext-runtime-0.19.4 (installs files into the same place).  P  roblematic file: /usr/local/bin/envsubst
*** Error code 70
```

Also, as a side note, how weird is it that updating ghostscript9-nox11 results in a complaint that ghostscript9-nox11 conflicts with ghostscript9, because "installs files into the same place". :\

Anyway, we build memcached from source after having downloaded the distribution tar ball skipping pkg/ports/portmaster/etc, something I did NOT want to do.

SirDice I figured as much. I will look into running our own repository. Just haven't gotten around to that just yet. Perhaps I shall attempt to pick your brain on that sometime in the near future.


----------



## Freitase (Mar 20, 2015)

InvaderZim, I just stumbled over your post here. We had the same problem: The buildserver would deliver nagios with php 5.6 while our own code would need php 5.4. As pointed out by ljboiler, the solution in this case would be to build nagios by ourselves.

But let me add:

Once you do that, I would recommend to build everything by yourself. We ran into hard-to-resolve dependency problems when a part of the software was installed with pkg and the other part built from ports. Because pkg packages can not know about how you configured the stuff you built yourself.
Read UPDATING! Really, do it. There is a hint in UPDATING about your gettext issue.


----------

