Slackware HowTo

Configure PHP CLI and php.ini on Slackware

Align PHP behavior for local scripts, cron jobs, and maintenance utilities.

1. When to use it

This guide is useful when PHP scripts started from shell or cron behave differently from the web side.

php | php.ini | CLI | memory_limit | modules

2. Base setup

cp /etc/php.ini-production /etc/php.ini
sed -i 's/^memory_limit = .*/memory_limit = 256M/' /etc/php.ini
php -m | sort | head

Adjust host names, IPs, interfaces, paths, and versions to the real system before making the change persistent.

3. Quick verification

php -i | grep 'Loaded Configuration File'
php -r 'echo ini_get("memory_limit"), PHP_EOL;'
grep -n '^memory_limit' /etc/php.ini

Confirm that the output matches the expected state before considering the intervention complete.

4. Operational notes

Keep expectations aligned between PHP CLI and PHP-FPM, especially if the same scripts run via cron and via web.

Quick checklist

[ ] Steps completed\n[ ] Config updated\n[ ] Tests executed\n[ ] Rollback ready\n[ ] Logs checked

Back to Linux HowTo