Rabi
Rabi

Reputation: 217

Does php-cli have its own binary?

1- When running php cli, does this use the same main php binary used by web servers (for example php cgi or php-fpm), or it's a seperate binary?

2- When installing php as fpm, two packages are required, php and php-fpm, so what's the difference between the two? thanks...

Upvotes: 0

Views: 364

Answers (1)

ino
ino

Reputation: 2591

For sure each of them could use different php.ini configuration file therefore each of them could behave differently, ie using different binaries, modules, etc.

Create a file phpinfo.php in your web root with content:

<?php 
echo phpinfo();

and run it:

  • via GLI using http://localhost/phpinfo.php
  • via CLI using php /path/to/your/web/root/phpinfo.php
  • or call from your terminal php -i

And compare the differences.

Note: to quickly find what *.ini files are in use you could:

  • call function print_r(php_ini_loaded_file()); in your GLI script
  • call php --ini in your terminal CLI

Upvotes: 2

Related Questions