Pages

Saturday, April 24, 2010

Initial installations before developing php extensions.

To develop php extensions we have to be installed php in our system. Since it takes time and involve lot of works we can easily forget the steps we have to follow. Therefore I decided to document the steps I followed when setting up my development environment. I use UBUNTU 9.04 as my platform for php-tsql research works. Before we do anything it's necessary to install some development tools which require in extension development life cycle. Therefore you first install the latest versions of following packages in to you system.

But remember that some of the packages may require some other once to be installed previously. If the installation stop somewhere, look at the error and install the requesting package first. Then you can install the interrupted package again. These kind of installations require a huge patience because it may take lot of time in progress printing different things and finally give you an error saying, without a particular package it cannot continue. Then you have to install that package patiently. All you have to do to install each package is,

Now I assume you have installed those packages. Now It's time to install apache server and php. download the sources of apache2 and php. Decompress the package files and spend some time reading readme files in those. I think most important one is INSTALL file in php. Now we're installing apache2.

./configure --with-apxs2=/usr/local/apache2/bin/apxs
make
sudo make install

If these steps completed without any error, php is installed. But you have to do some more before you start using php.

step 4: To setup your php.ini file, give the command

cp php.ini-development /usr/local/lib/php.ini

step 5: You have to make sure whether apache2 is aware of the installed php. Open the file httpd.conf (it should be in /usr/local/apache2/conf directory) and check whether this kind of an entry is there in the file,

LoadModule php5_module modules/libphp5.so

If not, put that line in the file.

step 5: In that httpd.conf file put this line also in the correct position,

AddType application/x-httpd-php .php .phtml

Now php also installed correctly. To check whether php is working, copy following code to a php files body named testinfo.php and put it in the htdocs directory of apache2.
phpinfo();