After you’ve installed Seiden CommunityPlus+ PHP, use our siteadd tool to quickly create (or remove) a PHP web server instance. With one command, you can build an Apache HTTP instance from a template, with a proper FastCGI configuration. You can easily create multiple web server instances, each with its own PHP .ini configuration.

Installing siteadd

Before you begin, make sure your user profile has *IOSYSCFG authority. It’s not enough to have membership in a group with this authority.

Install siteadd from our repository. You can use the Access Client Solutions (ACS) Open Source Management Tool, or, after setting up the path, run the following yum command:

yum install siteadd

Adding sites

After installing siteadd, run the command addsite with the desired instance name (subject to IBM i object naming rules) and the port number it should listen on. Choose a port that is not in use (run the NETSTAT command to find one). As an example, to create an Apache instance named SEIDENPHP that listens on port 8080, run this command:

addsite -n seidenphp -p 8080

The new site will be created with server root /www/seidenphp and document root /www/seidenphp/htdocs. You can now start the instance to see its default page. You can add your own PHP scripts under the htdocs subdirectory.

By default, the addsite command gives each site its own PHP settings in a subdirectory called phpconf and its own error log under logs. In our example, the new site would use PHP .ini files from  /www/seidenphp/phpconf and PHP error log in /www/seidenphp/logs.

If, however, you would prefer just one global set of .ini files, installed under /QOpenSys/etc/php (our “classic” configuration from the original addsite command), add the -i option:

addsite -i -n seidenphp -p 8080

Display information about a site

To see important facts about your site, run the dspsite command, which is included with the siteadd package (you may need to update siteadd first). You can learn whether your site is autostarted, where the error log is located, and the php.ini file path. Let us know if there are additional facts you’d like to see.
Example (substitute your own site name):

dspsite SEIDENPHP

Sample results:

Physical file: /QSYS.LIB/QUSRSYS.LIB/QATMHINSTC.FILE/seidenphp.MBR
     -apache -d /www/seidenphp -f conf/httpd.conf
Site directory (logs, htdocs, conf): /www/seidenphp
Log file (global): /QOpenSys/var/log/php_error.log
PHP config dir (i.e. php.ini) (global): /QOpenSys/etc/php

Removing sites

(CAUTION!) When you want to delete an Apache instance: stop the HTTP instance, then run:

rmsite mysite

The site will be unregistered from HTTP administration and (CAUTION!) all files in its directory deleted.

Multiple versions of PHP via chroots

siteadd can create a site that uses a PHP sourced from a chroot, which can enable multiple versions of PHP in the same partition. Consult our documentation on how to set up chroots for more.

Advanced feature: Templates

siteadd can use different templates to pre-populate the a site with different configuration. This can speed up making sites if you find yourself having to repeat the same steps over and over.

Templates are by default, located in /QOpenSys/pkgs/share/siteadd, but you can specify a relative (with ./) or absolute path name to the template. Since database co-existence, there have been no additional templates other than the default. If you have a template, you can make a site with it like so (note that to create the site-specific PHP configuration the -I flag must be used):

addsite -p 8080 -n testsite -I -T your-template-name-here

For those who wish to make their own templates, the template format is documented in the siteadd README shipped inside of the RPM.

Learn more about siteadd

Complete documentation and more examples are available on our siteadd Github repository.

Got Issues? GET ANSWERS!

Your open source should be trouble-free. If your current open source environment is anything less than perfect, we can help!

(or call 201.447.2437)

Seiden Group Documentation Library

Open Source Environment
ODBC
CommunityPlus+ PHP Setup
NOTE: To gain access to any protected pages, you must first download CommunityPlus+.
PHP (General)
Apache & Other Web Servers