Hi
I have installed magento 2.4 in MAMP server. Installation was successful and Nginx is configured to access magento2.
While accessing magento in browser i get following error
URL
http://127.0.0.1
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Applications/MAMP/htdocs/magento2/vendor/magento/framework/Code/Reader/ClassReader.php on line 34 Deprecated: Method ReflectionParameter::getClass() is deprecated in /Applications/MAMP/htdocs/magento2/vendor/magento/framework/Code/Reader/ClassReader.php on line 34 Parse error: syntax error, unexpected token "match", expecting identifier in /Applications/MAMP/htdocs/magento2/vendor/magento/module-elasticsearch/SearchAdapter/Query/Builder/Match.php on line 20
Installation command used
bin/magento setup:install \ --base-url=http://localhost \ --db-host=localhost \ --db-name=magento \ --db-user=magento \ --db-password=magento \ --backend-frontname=admin \ --admin-firstname=admin \ --admin-lastname=admin \ --admin-email=admin@admin.com \ --admin-user=admin \ --admin-password=admin123 \ --language=en_US \ --currency=USD \ --timezone=America/Chicago \ --use-rewrites=1
PHP version
php -v PHP 7.4.12 (cli) (built: Nov 30 2020 13:28:43) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
Elastic search version and status
curl -XGET 'localhost:9200/_cat/health?v&pretty' epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 1617940234 03:50:34 elasticsearch_machine yellow 1 1 1 1 0 0 1 0 - 50.0%
curl -XGET 'localhost:9200/cluster/health' {"error":"Incorrect HTTP method for uri [/cluster/health] and method [GET], allowed: [POST]","status":405}M-C02Z94FCLVCG:proactiveactionengine dheerajo$ curl -XGET 'localhost:9200/_cluster/health' {"cluster_name":"elasticsearch_dheerajo","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":1,"active_shards":1,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":1,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":50.0}
Composer version check
composer show elasticsearch/elasticsearch Cannot create cache directory /Users/machine1/.composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache Cannot create cache directory /Users/machine1/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache Cannot create cache directory /Users/machine1/.composer/cache/files/, or directory is not writable. Proceeding without cache name : elasticsearch/elasticsearch descrip. : PHP Client for Elasticsearch keywords : client, elasticsearch, search versions : * v7.7.0 type : library license : Apache License 2.0 (Apache-2.0) (OSI approved) https://spdx.org/licenses/Apache-2.0.html#licenseText homepage : source : [git] https://github.com/elastic/elasticsearch-php.git 1d90a7ff4fb1936dc4376f09d723af75714f6f05 dist : [zip] https://api.github.com/repos/elastic/elasticsearch-php/zipball/1d90a7ff4fb1936dc4376f09d723af75714f6f05 1d90a7ff4fb1936dc4376f09d723af75714f6f05 path : /Applications/MAMP/htdocs/magento2/vendor/elasticsearch/elasticsearch names : elasticsearch/elasticsearch autoload files psr-4 Elasticsearch\ => src/Elasticsearch/ requires ext-json >=1.3.7 ezimuel/ringphp ^1.1.2 php ^7.1 psr/log ~1.0 requires (dev) cpliakas/git-wrapper ~2.0 doctrine/inflector ^1.3 mockery/mockery ^1.2 phpstan/phpstan ^0.12 phpunit/phpunit ^7.5 squizlabs/php_codesniffer ^3.4 symfony/finder ~4.0 symfony/yaml ~4.0 suggests ext-curl * monolog/monolog Allows for client-level logging and tracing
Any suggestions to solve this issue.
Hello @dheerajjos45f2
You didn't actually pass elasticsearch parameters while installing Magento by command,
Also check your php version for the errors, echo phpinfo(); exit; in your index.php file.
Install command reference : https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli.html
Default elastic search parameters are fine for my deployment.
Issue was with MAMP. Even though php 7.x is configured in MAMP, for some reason it was taking fast cgi of PHP 8 and not PHP 7.x
I had to modify nginx start up script to fix it.