0

I'm trying to get MongoDB working with LAMPP here. EDIT : Question was closed citing another post PHP Phar issue. This isn't about that.

Timeline of Events:

  1. Installed LAMPP (PHP 8.2.4)

  2. Installed MongoDB driver using sudo /opt/lampp/bin/pecl install mongodb.

  3. Edited the php.ini of LAMPP which is in /opt/lampp/etc/php.ini- added ;extension=mongodb.so. I don't know to which PHP this got installed, as later when I check the installed modules of LAMPP's PHP using /opt/lampp/bin/php-8.2.4 -m | grep mongodb, mongodb was not listed in the modules.

  4. Installed composer not with LAMPP's PHP but the system PHP - I don't remember the command.

  5. Tried composer require mongodb/mongodb inide my project folder /opt/lampp/htdocs/EMS - command composer not found.

  6. Removed composer using PURGE, and installed composer again with the command: curl -sS https://getcomposer.org/installer | sudo /opt/lampp/bin/php-8.2.4 -- --install-dir=/usr/local/bin --filename=composer

viswesh@viswesh-ubuntu:/opt/lampp/htdocs/EMS$ curl -sS https://getcomposer.org/installer | sudo /opt/lampp/bin/php-8.2.4 -- --install-dir=/usr/local/bin --filename=composer All settings correct for using Composer Downloading...

Composer (version 2.5.8) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer

  1. Now trying to install mongdb using composer: /usr/local/bin/composer require mongodb/mongodb

PHP's phar extension is missing. Composer requires it to run. Enable the extension or recompile php without --disable-phar then try again.

  1. Then thought maybe it is referring to the global PHP again. Hence tried: sudo /opt/lampp/bin/php-8.2.4 /opt/lampp/bin/pecl install mongodb , and I'm getting this script on the console.. (image attached)enter image description here

0 Answers0