logo

One Server with PHP and Domino

Until now I had assumed the only way to get Domino and PHP to run on the same server was to run one of them on a different port. This approach has been documented a few times already and hinges on running Domino on port 81. It works well until you start submitting forms and using authentication. At this point Domino starts adding the :81 to the URL and the browser thinks you need to login again.

Not happy with this approach I had opted to only running the server I wanted to develop with on any particular day. Then, this weekend, I hit upon an idea. Why not assign the server two IP addresses and two host names? Domino can run on one, PHP on the other. What surprised me was how easy it was to do this. Here's an abridged how-to.

First thing to do is add another network device to the server (I'm using Redhat 9). Not a new card, just a new "device" that runs on the same network card. Open the Network Config panel and add a new device. Give it a static IP that's different to the IP the server currently uses. My dev server was running on 192.168.0.50 so I added the new device as 192.168.0.51. This, in effect, creates the illusion of there being another server on the network.

Redhat Network Config

I am going to run Apache on this IP address, so I open the HTTP Server Settings dialog and tell it what IP address to listen on, as below:

Redhat HTTP Server Config

Domino is going to run on the original IP address. All I need to do is tell it to only run on this address by binding it to it. In the Server Document make sure this is enabled, as below:

Domino Server Config

Notice how some of these settings rely on host names rather than IP addresses? We also need to make DNS changes. Originally my domain's DNS records had one IP address (.0.50) registered for both the "php" and the "domino" hosts. All I had to do was edit the php host record to point to (.0.51).

So far, everything works really well. It really does feel like I've got a free server! Why share this with you? Well, I know I'm not the only one with an interest in both PHP and Domino and with their own server to play with. As with everything else I share I just hope it's of use to some of you...

Comments

    • avatar
    • Stu
    • Mon 19 Jul 2004 06:58

    What are the advantages of using Linux as a development server, rather than windows. Should I migrate, Where can I get Linux from???

  1. How clever!

    I wonder if this would work under Windows 2k/XP? Where you add a TCP/IP protocol, I presume.

    This is so much cleaner than the ports solution.

  2. This is a similar solution to one I posted a few years back to run IIS and Domino on the same server & port 80. Back then we have a http.cfg file to contend with, bind to host in the server document made thing much easier. Jake thanks for sharing this, I don't recall ever seeing this in the print media, I don't know why this is great for small shops tht develop on more than just Domino.

  3. Sorry, hit post before I answered Dave's question, Yes!!, this will work with NT/2000/XP.

  4. Interesting and simple.

    As a system administrator this was so obvious I wondered why nobody knew this already :-)

    But then in the servers I used to work with there are always multiple IP-addresses and multiple network cards available, so I never considered this as to not be obvious.

    I have another question though.

    Would you know of an easy way to host php pages on a domino server where there is no other web server present?

    If you need everything to be hosted on the same domain, for example this would be a very good solution.

    • avatar
    • Jake
    • Mon 19 Jul 2004 08:46

    Jean Marie. Nothing like this is obvious to us lowly developers ;o)

    You can run PHP as a .exe on any web server (I think) but it's not advisable from a security POV.

    Personally I like to keep Domino alone. It doesn't play well with the other kids!

    • avatar
    • Jean Marei
    • Mon 19 Jul 2004 10:42

    LOL.

    I'm an administrator turned developer, so I have a good understanding of both sides, which does give me an advantage in development as well. Since I can remember a lot of the pitfalls from my administrator days, I tend to look at this when I'm developing.

    I know it's possible to have the php.exe somewhere and then call it to host the pages, but I haven't find an elegant (and secure) solution for it yet.

    If ever I do, I'll let you know !!

  5. Jake,

    What tool do you use to edit the configuration of the apache server ? It seems easier than editing the httpd.conf file...

    And have you ever tried to configure SSL (https) for multiple named based virtual hosts ? apparently only possible using multiple IP...

    Thanks,

    Gaston

    • avatar
    • Jake
    • Mon 19 Jul 2004 10:54

    Gaston. It's the standard "HTTP Server Settings" panel that comes with Redhat 9.

    Not an SSL expert by any means.

  6. Jake,

    I have 3 servers running on one box, one IP, and these include both Apache and Domino together. I do not get the port 81 added by Domino at any point, I think this is because I do not rewrite URLs, I proxy them. This is very simple to implement. I have explained it in this article:

    {Link}

    However, I think your solution is more elegant and better separates web servers from each other. Thanks for sharing this!

  7. Has anyone tried using Websphere as the HTTP server for Domino, or has that offer been retracted by IBM? In R6 they included a restricted Websphere license to use WS as the HTTP server. In theory... since Websphere is really Apache, this might fix some of the Domino-centic web issues. I had IBM Global Services in to do a domain upgrade and asked them about this and none of them knew how to do it. Seems that the Notes and WS groups don't speak to each other.

    • avatar
    • Marcin
    • Mon 19 Jul 2004 17:31

    Ed - Search for "IBM HTTP" in the R6 Admin help. It has all the information you need to setup IHS (ie. the web server Websphere uses) to talk to Domino via a plugin.

  8. Gaston: SSL is not possible on name based virtual hosts, only on IP based hosts, because the Host: header passed in during the connection is encrypted and cannot be decrypted by the web server in order to determine which host to actually send it to. Catch 22.

    • avatar
    • Gareth
    • Tue 20 Jul 2004 07:06

    You can run PHP as an exe and setup a url->directory redirect document, with the choice to 'execute'.

    Then anything with a *.php extension will be processed by php, and everything else by domino - easier than the 2 port solution and no need for apache or iis if you are using the domino stack.

    as jake said tho - might by a tad insecure this way.

  9. Admin Help (R5) has some information on this multi-homing also (search for "Assigning separate IP addresses with a single NIC"), including command line info on HP-UX and AIX which might be of some use for those who run macho Linux servers ;-)

  10. Jake,

    I'm thinking of following your lead and jumping into Linux -- but I'm wondering if there is any downside to using the workstation (i.e. Redhat 9) versus the server kernel (Enterprise v.3).

    Thanks

    • avatar
    • Jake
    • Tue 20 Jul 2004 10:20

    You're asking me Patrick? I didn't even know there was a difference ;o)

  11. Patrick, you might want to look at IBM's hardware requirements for Domino 6 and 6.5:

    {Link}

    {Link}

    RH9 is not officially supported. I've installed R5 on remote, non-GUI RH 7.2 servers with no problem. If you are only going to be tinkering with a development server, then I think you should try it on whatever distro you find easiest to use (I found R5 also worked fine on every version of Mandrake I tried.)

    Incidentally, Jake. Do you find that @Environment works on Linux? I find I can get and set the env vars through the server console, and through configuration docs, but trying in formulas or Lotusscript just doesn't work.

    • avatar
    • Jake
    • Tue 20 Jul 2004 12:34

    Sorry Bernard, I don't use environment variables, as a rule, so don't know.

  12. Installing a reverse proxy is the way to go. This can also handle the SSL connections too, so your web servers don't have to each be set up for SSL. It also provides some network performance benefits as well since the proxy buffers the http transaction meaning the web server spends less time in network IO.

    The one we ship with Puakma is written in Java so runs on any platform too.

    {Link}

    Brendon.

  13. I have used this process for a number of years -- ever since Domino was ported for Linux servers. Previously I used Apache's ability to do a proxypass. I was shocked to learn that I could also authenicate without major problems -- this was the R5 world.

    With two web servers (apache and domino each with unique ip addresses), I can share content as well as long as I have domino connect to MySQL.

    just my 2 pense worth.....

    • avatar
    • Moyses
    • Fri 23 Jun 2006 06:36 PM

    i want to use that same configuration except for apache. i need IIS (running on win2003 server). i can see that domino (r6) is binded to one IP (not for second one) but when i start IIS (on second ip) it gives me an error, telling that port is already use! when i stop domino and start iis again it works fine (serving only on second ip). any glue on that?

    moyses

    • avatar
    • r2
    • Fri 16 Feb 2007 02:09 AM

    Moyses: read this:

    {Link}

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 19 Jul 2004

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content