# PHP 5.5



## xcpdq (Dec 14, 2016)

Hi,

I know PHP 5.5 is deprecated but I was wondering if there's still a way to install it somehow (preferably from ports)? I have a PHP script that only works with versions below PHP 5.6. Will it work if I install it from source?

Thanks!


----------



## obsigna (Dec 14, 2016)

xcpdq said:


> ... I have a PHP script that only works with versions below PHP 5.6. ...



Well, I would investigate, why that script does not work with a more recent version of PHP. Since year 2000, when I started with PHP4, I updated my installations at various points in time to the respective recent PHP version, and I never had serious problems. Only the update to PHP 7 was a little bit more involved because I needed to switch from the deprecated extension php56-mysql to php70-mysqli.

I am very satisfied with PHP7 and the promised performance gains are actually perceivable.

That said, only as the very last resort, I would go for the following procedure, and perhaps only for having sort of a reference implementation which might help upgrading to PHP7:

As root user do:
`# mkdir -p ~/install/my-ports`
`# cd ~/install/my-ports`
`# svn checkout http://svn.freebsd.org/ports/tags/RELEASE_11_0_0/lang/php55 php55`
`# svn checkout http://svn.freebsd.org/ports/tags/RELEASE_11_0_0/lang/php55-extensions php55-extensions`

You need to remove any existing PHP from your system before proceeding with the actual installation:
`# cd ~/install/my-ports/php55`
`# make rmconfig`
`# make install clean`

Optional installation of extensions -- choose what you need from the configuration dialog:
`# cd ~/install/my-ports/php55-extensions`
`# make rmconfig`
`# make install clean`


----------



## xcpdq (Dec 14, 2016)

Thank you obsigma!

I asked the developers why the script doesn't work with PHP 5.6 or 7.0 and their reply was:



> Unfortunately it is not easily possible. PHP 7.0 doesn't support the old mysql API, which is widely used.
> We will have to refactor big amount of code and this will take much time (mainly testing). The only possible way is to start refactoring and move incrementally. We will start doing this in 4.0 and sometimes will end up with removing old mysql code completely.



They didn't say anything about PHP 5.6 so I'm assuming it's the same reason.

Thank you again for helping me with a solution. I will install PHP 5.5 this way.


----------



## obsigna (Dec 14, 2016)

xcpdq said:


> ... They didn't say anything about PHP 5.6 so I'm assuming it's the same reason. ...



Definitively No, the old mysql driver has been deprecated only with PHP 7, and it is still available with PHP 5.6. I suggest, to ignore the exact PHP 5.5 requirement and read PHP 5.x instead. I suggest to install PHP 5.6 regularly from the ports, and I would be very surprised if this would be incompatible with said code.


----------



## xcpdq (Dec 14, 2016)

I will try going with 5.6 after all. It seems I can't install any PHP 5.5 extensions. Getting the following error:


```
/!\ WARNING /!\
The variable PHP_DEFAULT is set and it should only be defined through DEFAULT_VERSIONS+=php=5.5 in /etc/make.conf
This behaviour has never been supported and will be removed on 2017-01-31

Unknown extension ctype for PHP 55.
*** Error code 1

Stop.
make[1]: stopped in /root/install/my-ports/php55-extensions
*** Error code 1

Stop.
make: stopped in /root/install/my-ports/php55-extensions
```

This happens for every extension I try to install.

Thank you again! Much appreciated.


----------

