Shared hosting¶
Be honest about the limits: the PHP extension has to be installed by the
hosting provider. A customer on shared hosting cannot drop a .so into the
provider's PHP build; on CloudLinux/CageFS boxes the PHP binary and
extension_dir are owned by the host and per-user .user.ini can only set
phpray.* directives, not load extensions.
What a customer can do¶
- Ask the host to enable PHPRay. One line in their support request:
"please install the PHPRay PHP extension for my account (see
phpray.dev/docs/install/shared-hosting)". If the host has it installed
fleet-wide, you only need
php_value phpray.enabled=1in.user.ini. - Use the WordPress plugin instead. The PHPRay WordPress plugin works on any shared host with no extension: it hooks into WordPress (plugins, themes, queries, HTTP API, errors) and ships the same trace format to the collector or to PHPRay Cloud. See WordPress plugin.
- Know what the plugin cannot see. The plugin is a userland library: it cannot see raw request timing around the PHP core, C-extension internals, memory peaks outside its sampling, or non-WordPress sites on the account. The extension sees all of those; the plugin sees the application layer.
For hosts¶
DirectAdmin¶
- Build
phpray.sofor each PHP version you expose, or use the prebuilt release matching the version + glibc + arch of your server. - Add
extension=phpray.soto the per-versionconf.dused by your lsphp/apache modules, or per account via the account's.user.inidefaults if you only want it opt-in.
cPanel / CloudLinux¶
- Install the
.sointo the alternative PHP handler:/opt/cpanel/ea-php<ver>/root/usr/lib64/php/modules/(or the equivalent path for your EA-PHP version) and addextension=phpray.soto a file in/opt/cpanel/ea-php<ver>/etc/php.d/. - CloudLinux's CageFS isolates per-user homes but the EA-PHP module path is globally readable, so one install covers all users on that PHP version.
Per-user control¶
Users can toggle everything in their ~/.user.ini (picked up by FPM and
lsphp; mod_php needs php_value in .htaccess):
You can also default to off fleet-wide and let users opt in, or the reverse.