# Latest php



## balanga (Aug 3, 2017)

How do I find the latest version of php available on FreeBSD?

I found that `pkg install php70` found a pkg but  `pkg install php71` didn't even though I do have 7.1.2 installed on one system and php71 exists in /usr/ports/lang/php71


----------



## obsigna (Aug 3, 2017)

Most probably your machine is configured to obtain updates from the quarterly pkg repository. Try again after informing pkg to use the latest repository:

As user root do:
`mkdir -p /usr/local/etc/pkg/repos`
`nano /usr/local/etc/pkg/repos/FreeBSD.conf`

```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
}
```
Then try again.


----------



## balanga (Aug 3, 2017)

obsigna said:


> Most probably your machine is configured to obtain updates from the quarterly pkg repository. Try again after informing pkg to use the latest repository:
> As user root do:
> `mkdir -p /usr/local/etc/pkg/repos`
> `nano /usr/local/etc/pkg/repos/FreeBSD.conf`
> ...



I found it was already set. In any case php71 has been available for over 6 months so I should have been able to install it if it was set to quarterly, but I get

```
pkg: No packages available to install...
```

I'm running this in a FreeBSD 10.3-STABLE jail. I don't know if that makes any difference.


----------



## rigoletto@ (Aug 3, 2017)

Yes, it seems there are no lang/php71 for 10.3. However it is in there for 11.1.

With 10.4 coming in a couple of months, it should appear on that time.


----------



## xavi (Aug 3, 2017)

lebarondemerde said:


> Yes, it seems there are no lang/php71 for 10.3. However it is in there for 11.1.



I was under the impression that all versions on all architectures use the same ports tree. So, why is it that php7x is not available under 10.3?  I'm running 10.3 with a view to using PHP, so this might push me to upgrade to 11.1.


----------



## SirDice (Aug 3, 2017)

xavi said:


> I was under the impression that all versions on all architectures use the same ports tree.


That's correct.


> So, why is it that php7x is not available under 10.3?


That's a good question because it should be there. It's possible there have been build issues on the clusters. So it's always good to check that: http://portsmon.freebsd.org/portoverview.py?category=lang&portname=php71

But, in this case, there are no errors reported. But there are no packages either. Strange.


----------



## SirDice (Aug 3, 2017)

Oh, checked pkg.freebsd.org and it's there: http://pkg.freebsd.org/FreeBSD:10:amd64/latest/All/php71-7.1.7.txz

But your mirror may be missing it. It's possible something went wrong during the sync causing the mirror to  be incomplete.


----------



## balanga (Aug 3, 2017)

SirDice said:


> Oh, checked pkg.freebsd.org and it's there: http://pkg.freebsd.org/FreeBSD:10:amd64/latest/All/php71-7.1.7.txz
> 
> But your mirror may be missing it. It's possible something went wrong during the sync causing the mirror to  be incomplete.



What do I need to do to make it available to me via `pkg install`?


----------



## balanga (Aug 4, 2017)

I've noticed that php71 pkgs exist under /var/cache/pkg  on another system. Is there any way I can use them? Could I just copy the required files to the system which is unable to install them via `pkg install`? Or can I change /etc/pkg/FreeBSD.conf to point at the other system?


----------



## ljboiler (Aug 4, 2017)

Sure, just copy the txz files ( the ones with the <pkgname>-<some 10 character suffix>.txz, the <pkgname>.txz file is just a symlink) and run `pkg add <filename>`


----------



## Phishfry (Aug 4, 2017)

Just make sure they are from the same architecture.

i386 packages vs. amd64 packages.


----------



## balanga (Aug 4, 2017)

Phishfry said:


> Just make sure they are from the same architecture.
> 
> i386 packages vs. amd64 packages.



How can I tell which?


----------



## Phishfry (Aug 4, 2017)

You must check your /var/cache/pkg box and see what `uname -a` shows for Arch.
Make sure it is the same that you are transferring to.

My point is a pkg.txz on i386 is different than a pkg.txz from an amd64 box. They have the same name though so that is why I brought it up.
Arm packages would be the same. pkg.txz would have same name but be built for arm only.

I am using pkg.txz as an example. The real name also includes the version number.


----------



## Phishfry (Aug 4, 2017)

So for example you could not use amd64 pkg.txz on Arm. You can copy /var/cache/pkg/* armv6 to armv6 like RPi to BBB.


----------



## balanga (Aug 4, 2017)

What I meant was is there any way I could tell from the archive itself by say, examining it, whether it is for i386 or amd64?


----------



## balanga (Aug 4, 2017)

ljboiler said:


> Sure, just copy the txz files ( the ones with the <pkgname>-<some 10 character suffix>.txz, the <pkgname>.txz file is just a symlink) and run `pkg add <filename>`



After I copy it, is there any way to `pkg install pkgname from cache` since `pkg install pkgname` is still trying to retrieve from the FreeBSD repository.


----------



## SirDice (Aug 4, 2017)

```
cd /var/cache/pkg/
pkg add <localpackagename>.txz
```


----------



## balanga (Aug 4, 2017)

```
pkg: wrong architecture: FreeBSD:11:amd64 instead of Freebsd:9:amd64
```

I'm trying to install in a FreeNAS jail, so I guess that explains it... I didn't realise that pkgs were built for specific versions of FreeBSD.
I wonder if building it myself will work... php71 does exist in /usr/ports/lang so I guess there's no harm in trying.


----------

