8

I install lampp on lixnux. Then install Magento 2. However, i get some errors when run setup:upgrade and setup:static-content:deploy. Please see image:
enter image description here

7

5 Answers 5

13

This will happen in normal cases.

Go to,

app/etc/env.php

Change

'host' => 'localhost',

Into

'host' => '127.0.0.1'

Run the upgrade now.

Good Luck!

2
  • i do this but error still here:Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE[HY000] [2002] No such file or directory Exception #1 (PDOException): SQLSTATE[HY000] [2002] No such file or directory Dec 24, 2019 at 8:27
  • I see this fix everywhere, but I don’t understand how it works. Why would localhost not work?
    – bfontaine
    Jan 19, 2021 at 16:33
7

This can happen if you have multiple versions of PHP on your system. For example, I had /usr/bin/php as well as the PHP from MAMP on my Mac, so running /usr/bin/php in the (cron job for indexing)

http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html#config-cli-cron-bkg would give the error shown in the question.

To resolve, I called MAMP's version of PHP in the cron commands, e.g.:

/Applications/MAMP/bin/php/php5.6.30/bin/php /Users/scott/Sites/mage_217/bin/magento cron:run
1
  • perfect answer!!! =1 :) Sep 16, 2018 at 11:50
0

Agreed with @scott response or you can simply override the php.ini location and replace it with the one you have.

Here are the instruction for how to do that on Mac.

https://gist.github.com/irazasyed/5987693

0

first of all check your apache2 service

service apache2 status green mean its running.

Otherwise run sudo systemctl start apache2 command to run the apache2 service,

and then check your mysql service is running or not.

run service mysql status green mean running.

otherwise run sudo systemctl start mysql to run the mysql service then you are good to go.

refresh the page the error will be gone.

Tip: service --status-all will show all the running(+) and stop(-) services

-1

Simply replace the magento file in bin directory with the new one and run the following command on magento file if your host is linux:

enter image description here sudo chmod u+x bin/magento

Note: Before running bash command make sure your current working directory must be Magento 2.x root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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