Using PHP on a Domino Server via CGI

Sat Jul 16 21:34:21 EDT 2011

Mostly on a lark but partly for practical reasons, I wanted to set up PHP on my Linux-based Domino server. While an easy option would be to install Apache and have it use a non-80 port, I wanted to see if Domino's ancient CGI support still works in the modern world of today.

In short: yes. In fact, it's pretty easy; the bulk of the work I put into it was actually just because I refused to believe that the syntax on that IBM page and in Administrator's documentation wasn't a typo. On my Ubuntu-based server, the setup is quick:

  • Run "apt-get install php5-cgi"
  • Set "cgi.force_redirect = 0" in your php.ini file. In my case, this didn't exist, so I created it as /etc/php5/cgi/conf.d/php.ini with just that line. If you don't do this, you'll get errors about the CGI app not returning any output
  • Add a rule to your web site with the following setup (using the path to your PHP CGI binary as needed):
    • Type of rule: Directory
    • Incoming URL pattern: /*.php
    • Target server directory: /usr/bin/php5-cgi\*.php
    • Access level: Execute
  • Place your scripts in the domino/html directory in your server's data directory

    That backslash is actually there and there actually isn't any space in front of it. It's really weird, I know.

    If everything went well, you should be able to refresh HTTP and voilà: you can execute PHP scripts. I haven't investigated it super-thoroughly for edge-case gotchas, but it runs phpinfo() just fine, and you don't have to worry about making your PHP scripts executable or anything.

    One important thing to bear in mind is that this is just CGI. Your PHP code isn't going to suddenly have access to the Domino API in any new way - this isn't a new way to write Notes apps on the web. If you want some sort of API access, on Windows you could use OLE and on other platforms you could presumably compile a version of PHP with Java support, but that's about it. That said, you DO get the benefit of Domino handing off any authenticated user name (even using some crazy DSAPI method), so it's not COMPLETELY isolated from the rest of the server.

    Commenter Photo

    Dmitrijus Berescanskis - Thu Jul 03 12:15:56 EDT 2014

    Thank you very much, especially about backslash :) was very helpful :)

    New Comment