PHP configuration
PHP can vary between OS distributions; see the documentation specific to your installation of PHP.
-
First determine which PHP
.ini
file is in use by the PHP Apache module.NoteIt may not necessarily be the same
.ini
file that is in use when calling PHP from the command line (runningphp --ini
from the command line reports this).If you are having trouble determining which
.ini
file the PHP Apache module is using, create a PHP file that can be served through Apache with the following contents:<?php phpinfo();?>
Point your browser to this file and look for this table row in the resulting table:
Loaded Configuration File
-
Open the
php.ini
configuration file and increase the memory_limit to 512M, default value is 256M.Large changelists may fail to submit if the memory_limit is too low.
An example memory_limit setting in
php.ini
:memory_limit = 512M
-
Ensure that
date.timezone
is set correctly for your system.Some distributions do not make a default timezone available to PHP, so the best practice to set the timezone for PHP explicitly. See the list of supported timezones.
An example
date.timezone
setting inphp.ini
:date.timezone = America/Vancouver
-
Verify that the iconv, json, and session extensions are present.
They are usually enabled by default, although you may have to install packages for them through your OS distribution. Verify they are present by searching for their respective names in the
phpinfo
output above. -
Enable P4PHP, the Perforce extension for PHP:
For Swarm to communicate with the Helix Core Server, it needs the P4PHP extension. P4PHP variants are available for each PHP 8 version supported by Swarm and each variant is available as either openssl 1.02 or openssl 1.1.1. All of the P4PHP variants are supplied with the Swarm package and tarball installations.
Note- For Linux, the default variants are compiled with glibc 2.11.
- P4PHP 2019.1 or later is required for Swarm 2019.1 and later.
- perforce-php8x.so compatible with systems using SSL 1.0.2
- perforce-php8x-ssl1.1.1.so compatible with systems using SSL 1.1.1 (by default, Ubuntu 20.04 uses SSL 1.1.1)
- perforce-php8x-ssl3.so compatible with systems using SSL 3.0.0 (by default, Ubuntu 22.04 and 24.04 uses SSL 3.0.0)
- The Swarm web-page will not load and you might see a Connection Reset error.
- There might be an undefined symbol: SSLeay message in the Apache error log
Swarm package and tarball installations: two versions of P4PHP are supplied for PHP 8 version supported by Swarm. They are located in the p4-bin/bin.linux26x86_64 directory.
Where x is the version of PHP 8.
If the perforce.ini file is not pointing at the correct version of P4PHP and you connect to an SSL enabled Helix Core Server:
To enable P4PHP, edit the web server's
php.ini
file and add the following line:extension=/path/to/swarm/p4-bin/bin.<platform>/perforce-<variant>.so
Example 1: for a 64-bit Linux system running PHP 8.0 and SSL 1.0.2:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php80.so
Example 2: for a 64-bit Linux system running PHP 8.1 and SSL 1.0.2:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php81.so
Example 3: for a 64-bit Linux system running PHP 8.2 and SSL 1.0.2:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php82.so
Example 4: for a 64-bit Linux system running PHP 8.3 and SSL 1.0.2:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php83.so
Example 5: for a 64-bit Linux system running PHP 8.0 and SSL 1.1.1:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php80-ssl1.1.1.so
Example 6: for a 64-bit Linux system running PHP 8.1 and SSL 1.1.1:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php81-ssl1.1.1.so
Example 7: for a 64-bit Linux system running PHP 8.2 and SSL 1.1.1:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php82-ssl1.1.1.so
Example 8: for a 64-bit Linux system running PHP 8.3 and SSL 1.1.1:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php83-ssl1.1.1.so
Example 9: for a 64-bit Linux system running PHP 8.2 and SSL 3.0.0:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php82-ssl3.so
Example 10: for a 64-bit Linux system running PHP 8.3 and SSL 3.0.0:
extension=/path/to/swarm/p4-bin/bin.linux26x86_64/perforce-php83-ssl3.so
Alternatively, copy the extension file to the default location for PHP extensions, and then just add this line instead:
extension=perforce-<variant>.so
- Restart Apache for the changes to become active.
- To verify that P4PHP is active, navigate to the
phpinfo
file you created above. You should then see a perforce section (search for "Perforce Module"). It should report that the module is enabled and display the version information. - In addition, Swarm greatly benefits from the following optional extension: ImageMagick extension for PHP to improve Swarm's ability to preview graphic formats that web browsers typically cannot display, see ImageMagick (imagick) extension for PHP.
- Configure Swarm, see Swarm configuration.
Be aware that any operating system upgrades on the machine hosting Swarm may involve updates to PHP. If this occurs, the PHP .ini file needs to be updated to point to the correct variant
of P4PHP to match the version of PHP that the upgraded operating system is using.
ImageMagick (imagick) extension for PHP
Imagick is a PHP extension that integrates the ImageMagick graphics library's API for the creation and manipulation of images. Enabling Imagick improves Swarm's ability to preview graphics formats that web browsers typically cannot display and to create comment attachment thumbnails.
For more information, see:
-
We recommend that you install Imagick from your OS distribution, via
apt-get
,yum
, etc. If your distribution does not offer the imagick package for PHP, install it via PECL (although you may have to resolve system dependencies):sudo pecl install imagick
-
Verify that imagick is enabled in your PHP Apache module's PHP
.ini
file (as determined in the section above for P4PHP). You may need to add the following line:extension=imagick.so
-
Configure the ImageMagick policy.xml file to allow Swarm to create thumbnails if it is not already configured:
-
Open the ImageMagick policy.xml file for editing:
-
Disable lines with the pattern below for the following <filetype>s: PS, PS2, EPS, PDF, or XPS:
-
Save the policy.xml file.
- Restart Apache for the changes to become active.
-
To verify that imagick is active, navigate to the
phpinfo
file you created earlier. You should then see an imagick section. It should report its version information and a table for its directives, supported image file formats, and more.WarningOnce you have completed installing and enabling P4PHP and imagick, we recommend that you remove the
phpinfo
file you created to avoid disclosing information about your installation.
/etc/ImageMagick-6/policy.xml
<policy domain="coder" rights="none" pattern="<filetype>" />