PHP5 on SME server

Posted on March 5, 2008. Filed under: php, sme server, smeserver | Tags: , , , |

PHP is a most sought after web scripting language. On the other hand SME server by contribs.org is a wonderful linux distribution encompassing, security, mail and other services. However, present version smeserver 7.2 and smeserver 7.3 are prepackaged with php 4. Sometimes, its needed to use php5. More so, because PHP community has stopped support for PHP5 after 2007. If SME server is to be used for web applications, deployment of PHP5 is needed for many applications.

Following how to from firewall services have suggested a simple and decent way to deploy PHP5 (some issues still there)

Getting PHP5 binaries

PHP5 binaries. It is these binaries which are important and that is the trick as well. Here it is suggested to use PHP5 as CGI executable. Ok, so here are the method and sources

mkdir php5-cgi
cd php5-cgi
wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-5.1.2-1.sp.i386.rpm
wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-imap-5.1.2-1.sp.i386.rpm
wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-ldap-5.1.2-1.sp.i386.rpm
wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-mysql-5.1.2-1.sp.i386.rpm
wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-pear-5.1.2-1.sp.i386.rpm
wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-xmlrpc-5.1.2-1.sp.i386.rpm

It is to be noted here that PHP5, which is referred to here is CGI and another important aspect is that the version is PHP 5.1.2-1 . I did try to search for later version, but I did not find. I shall see if later versions are available and if so, update the link here

Optionally ODBC module (perhaps not needed mostly) is also there

wget http://sme.firewall-services.com/downloads/php5-cgi/php5-cgi-odbc-5.1.2-1.sp.i386.rp

Installation of PHP5-CGI

This is just simple

yum localinstall ./*.rpm

Enabling PHP5-CGI selectively

This part is multi-step and a bit complex. We need to do Custom Template for httpd.conf modification

We need to modify httpd.conf file so that php5 can be used for .php files. It is **important** to remember that we want to enable php5-cgi for some applications only and not througout the server and therefore it is need to twek the httpd.conf file to use php5-cgi *just* for designated directories.

Now, the decent way of sme server templating. We just make our ouw template and later expand it to generate httpd.conf of our liking.

Create a directory for httpd.conf template

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/

(Note that this step will be here. In original article it is mentioned at second stage)

Create a new template – Step 1

vim /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/80php5-cgi

with following entries

ScriptAlias /php5-cgi /usr/bin/php5
<Directory /usr/bin/php5>
       order deny,allow
       deny from all
       allow from all
       Options ExecCGI
</Directory>

Create a new template – Step 2

Configuring *selective* applications to be taken care by php5-cgi
We create a custom template for each webapp which need php5. For example, if we have installed in an ibay called ’myapp’, we shall create the file 90myapp or rather we can also create file named 90AddPHP52myapp

vim /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/90myapp

Entries to go in this file

<Directory /home/e-smith/files/ibays/myapp/html>
       AddHandler php5-cgi .php
       Action php5-cgi /php5-cgi/php
</Directory>

Create a new template – Step 3

Regenerate new httpd.conf by expanding the above template

expand-template /etc/httpd/conf/httpd.conf

Testing configuration file for syntax

httpd -t

Restart the web server

svc -t /service/httpd-e-smith

With this, the myapp ibay files will be executed by php5-cgi and rest will be handled by default installation of php4

Important

For these apps the php.ini file will be in /etc/php5

Original Article Ref: http://sme.firewall-services.com/spip.php?article46

Make a Comment

Make a Comment: ( 2 so far )

blockquote and a tags work here.

2 Responses to “PHP5 on SME server”

RSS Feed for Sys Notes Comments RSS Feed

Is there any solution for php 5.2 on SME yet?

Thanks,

perfect description of what to do. Not only gives me PHP5 in 5 minutes but also gives me some insight in SME’s template-stuff.

I’ve banged my head a few times on SME (it is not always up-to-date with the latest packages) but still like it very much since it works fairly well out-of-the-box. I do recommend SME for all users who are looking for a small and easy router or file-, mail- or web server.


Where's The Comment Form?

    About

    Technical information. My tech notes and references

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS
    • Subscribe in Rojo

    Meta

Liked it here?
Why not try sites on the blogroll...