# How to install PHP 5.3 on Freebsd



## myn01 (Oct 7, 2009)

Hello,
I just downloaded the PHP 5.3 tar.gz file and need to install it.
In the /usr/ports/lang/php5 directory I have an older PHP version that I need to replace with this one.

Can anybody tell me all the steps to install this new PHP version? 

The older version was installed with 'make install' from the ports directory but this one I don't know how to start.

In addition I need GD, MYSQL, etc. I've downloaded the latest version of GD but the situation is the same...

Thank you.


----------



## DutchDaemon (Oct 7, 2009)

Don't install tarballs from around the net, because you're likely to screw up your system in the end.

PHP 5.3 is in the process of being ported.
http://forums.freebsd.org/showthread.php?t=5132

Had it been as easy as 'just installing the tarball' it would already have been done.


----------



## myn01 (Oct 7, 2009)

OK, thank you for your advice Ben!!
But now I need to install the latest stable PHP version.
Which one do you recommend me? And the same thing for my previous post: How do I install it?


----------



## SirDice (Oct 7, 2009)

myn01 said:
			
		

> But now I need to install the latest stable PHP version.
> Which one do you recommend me? And the same thing for my previous post: How do I install it?


`# cd /usr/ports/lang/php5 && make install clean`

Make sure you select to build the apache module.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html

NB the package is build _without_ the apache module! So you really need to build using the port.


----------



## myn01 (Oct 7, 2009)

The exact situation is this: I had installed version 5.29, working fine except that GD wasn't completelly installed (I need JPG Support)
I read that it's necessary to rebuild PHP to add that feature.
I did what you mentioned, and now I have version 5.1.6 (older then the original) with less components than before (no MySql, no GD, etc).

Version 5.1.6 was on /usr/ports/lang/php5 but it appears that the server had built with version 5.29

What can I do to install the 5.29 version with all the components?


----------



## CodeBlock (Oct 9, 2009)

As already stated deinstall whichever version you have now, and install lang/php5. For GD stuff, install lang/php5-extensions and compile it with GD. You'll probably want some of the other extensions too. Just pick whichever you want/need and compile it.


----------



## myn01 (Oct 9, 2009)

Thank you. I already have installed version 5.1.6 with all the extensions.
What I need now is to upgrade to PHP version 5.2.9. How can I do it?


----------



## CodeBlock (Oct 10, 2009)

Was it installed via ports? Just update your ports collection (portsnap or cvsup), and do the standard upgrading (I personally use portmaster, so do `portmaster -Bd lang/php5`.

If it wasn't installed via ports, see my previous post in this thread.

Edit: Ports has 5.2.11, any specific reason you need .9?


----------



## myn01 (Oct 10, 2009)

It was installed using 

```
cd /usr/ports/lang/php5 
make config 
make install clean
```

The same with extensions.

I have installed 5.1.16 now. I don't know how to upgrade ports... Do I have to download the tar.gz file first or is there some automatic command?


----------



## DutchDaemon (Oct 10, 2009)

portsnap(8)--> update the ports *tree*
ports-mgmt/portmaster or ports-mgmt/portupgrade --> install/upgrade ports (software)

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html


----------

