I can't execute n98-magerun.phar, I get PHP Fatal error: Class 'Phar' not found.

I am using PHP 5.5.14 (cli)

Any hints how to solve this?


Check if the phar.so extension is present in your PHP installation. It has to be enabled in your php.ini file.

If it is not, you can either change your php.ini file, or should be able to call n98-magerun like this:

php -d extension=phar.so n98-magerun.phar

  • How can I enable it? – Black Nov 19 '18 at 12:47
  • ...it is written in my answer: If it is not, you can either change your php.ini file [...] – simonthesorcerer Nov 19 '18 at 12:55
  • I know, but the info is missing what I have to add to the php.ini to enable it. How does it work? – Black Nov 19 '18 at 12:58
  • 1
    There should be a line ;extension=phar.so. Remove the semicolon from the beginning, and save the file. If the line is not there, you can add it. If that results in an error, your PHP version has been compiled without that extension - but I have not encountered that so far. If the shell command I added in the answer works, this should not be the case. – simonthesorcerer Nov 19 '18 at 13:19
  • Does not work, I added the line and restarted apache2 but I still get PHP Fatal error: Class 'Phar' not found and PHP Startup: Unable to load dynamic library '/usr/lib64/php5/extensions/phar.so' even if I execute your command – Black Nov 19 '18 at 14:02

I solved it. I had to install phar by executing apt-get install php-phar


Try this : n98-magerun For Magento 1

  1. wget http://files.magerun.net/n98-magerun-latest.phar
  2. chmod +x ./n98-magerun.phar
  3. ./n98-magerun.phar list

Description About Db Commands


For Example:

  • BD export Command: ./n98-magerun.phar db:dump -c gzip
  • BD import Command: ./n98-magerun.phar db:import db_name.sql
  • cache clear Command: ./n98-magerun.phar cache:flush
  • Does not work, I get wget: option requires an argument -- 'O' and wget: missing URL – Black Nov 19 '18 at 10:20
  • answer update can you check @Black github.com/netz98/n98-magerun – Magento Developer Nov 19 '18 at 10:25
  • I still get the same error PHP Fatal error: Class 'Phar' not found in – Black Nov 19 '18 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.