Many users on our forum experience problems when migrating to PHP 5.3.x. Although the migration to PHP 5.3 itself is not such a big deal, many difficulties arise with Xdebug and PHPUnit configuration after migration.

I have to mention here that there are many possible configurations you can have and it's almost impossible to address every user's situation. Also note that Xdebug and PHPUnit are third-party software and therefore not under our control. This makes it even more difficult to give definitive answers.



So guys, let's start with Ubuntu without Xamp. My configuration is as follows:

Ubuntu 9.10 - the Karmic Koala
NetBeans IDE Dev (Build 100128-0012e6e7ad34)
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
PHP 5.2.10-2ubuntu6.4
Apache/2.2.12 (Ubuntu)
PHPUnit 3.4.1
Xdebug 2.0.4

Everything is working fine at the moment but I want to migrate to PHP 5.3. I'm trying to make my life easier and the first thing I do is look for a synaptic manager. I have no luck finding one, but I still have some options:

Let's start with building from sources. You can follow the next tutorial and install PHP using Dotdeb packages but I can't guarantee that it's stable.

Ubuntu from sources

Remove other php instances

The first thing I do is to remove my old PHP instances. The reason is simple. If something doesn't work, I don't wanna mess around with multiple instances, tediously searching them for a bug...

You can remove xdebug as well. (php5-xdebug)

What about Apache? I'll keep the packages I have installed, which are:

$ sudo apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev apache2-utils apache2.2-common apache2.2-bin apache2-doc

Download php5.3

Go to http://www.php.net/downloads.php and download sources or simply use command line

wget http://us3.php.net/get/php-5.3.1.tar.gz/from/this/mirror

You may want to download the latest development version from http://snaps.php.net (I downloaded 5.3.2 recently ;) )

Extract sources

tar xvfz php-5.3.1.tar.gz 

Sources will be extracted to folder php-5.3.1 if you use the command above.

Configure - well, now the fun begins

When building PHP you should decide what features it will support. I'm using Apache2 and MySQL but many of you will need other features like mcrypt etc. There should be no problem configuring PHP to use these features later.

$ ./configure --with-apxs2=/usr/bin/apxs2 --with-mysql --with-pdo-mysql
(notice: you will need --with-pdo-mysql for doctrine if you use symfony)

You may get an error complaining that apxs hasn't been found. This means that you are either missing the apache2-prefork-dev package or the path is wrong. Check if you have the apache2-prefork-dev package installed. If yes, then you need to locate apxs2. Refer to http://www.php.net/manual/en/install.unix.apache2.php if you don't know what's going on.

$ sudo apt-get install apache2-prefork-dev 

Make & Make Install

$ make 
Build complete.
Don't forget to run 'make test'.

$ sudo make -i install 

-i switch stands for ignore errors

Configure Apache

Check if the libphp5.so file exists in /usr/lib/apache2/modules/

$ ls /usr/lib/apache2/modules/

If yes, great! If no, something bad happened during the make install.

$ sudo vim /etc/apache2/mods-available/php5.load 

and insert

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so


$ sudo vim /etc/apache2/mods-available/php5.conf 

and insert

<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
$ sudo a2enmod php5
Enabling module php5.

To activate new configuration run:

$ sudo /etc/init.d/apache2 restart 
 * Restarting web server   [ OK ]

Check if PHP works in cli

$ php -v
PHP 5.3.1 (cli) (built: Jan 29 2010 17:27:29) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Check if the local web server handles PHP correctly

run file

<?php phpinfo(); ?>

You should get output about your current PHP version and installed modules (I am sure you know about phpinfo).


Ubuntu from dotdeb packages

Dotdeb provides PHP packages that should work with Ubuntu, see http://www.dotdeb.org/category/php/. This is a somewhat more convenient way to install php5.3.x than building from sources. However, we can't guarantee that it's stable ...

Add sources

Run gedit

$ sudo gedit /etc/apt/sources.list

and add the following lines to the end

deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all





I'll add some answers and solutions from the Netbeans PHP forum here (in time)

Something is wrong with my Apache and/or PHP installation doesn't work for me.

For Apache & PHP installation/build process questions, please refer to http://www.php.net/manual/en/install.unix.apache2.php.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo