cancel
Showing results for 
Search instead for 
Did you mean: 

Parse error: syntax error, unexpected ')'

Parse error: syntax error, unexpected ')'

I am new on magento platform, and trying to install magento2.4 with xampp server on my local machine, but when I am trying to run http://localhost/magento2

it is giving me below error:

Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\magento2\setup\src\Magento\Setup\Module.php on line 82

 

please help me how I can run my project successfully.

 

Regards

Shahzad

8 REPLIES 8

Re: Parse error: syntax error, unexpected ')'

Hello @shahzadsiddiqui 

 

Welcome to the community ! Hope it will be a great starting for you Smiley Happy

Please make a fresh installation by command :

 composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition Magento2.4

Create a database with name "MagentoDB"

once it is installed, please run this command to setup it :

bin/magento setup:install \
--base-url=http://localhost/Magento2.4 \
--db-host=localhost \
--db-name=MagentoDB \
--db-user=root \
--db-password=root \
--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

fill correct details in above command and hit enter.

Let us know if you still face any issue.

 

PS: URL with localhost only works with local machine Smiley Happy

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Parse error: syntax error, unexpected ')'

Hello @shahzadsiddiqui 

 

This is your PHP version issue, please upgrade your php to 7.3 or 7.4 then install using Command line as suggested by Gaurav. To install Magento 2.4 you must need elastic search install on your local machine.

Manish Mittal
https://www.manishmittal.com/

Re: Parse error: syntax error, unexpected ')'

Hi Gaurav,

 

Thanks for you reply, again I am facing below Issue while I am running command to create a new project in htdocs folder.

 

Please help where I am doing something wrong.

 

 

$ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4 magento24/
Creating a "magento/project-community-edition=2.4" project at "./magento24"
Warning from repo.magento.com: You haven't provided your Magento authentication keys. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
    Authentication required (repo.magento.com):
      Username: 
      Password: 

Do you want to store credentials for repo.magento.com in C:/Users/hp/AppData/Roaming/Composer/auth.json ? [Yn] n
Installing magento/project-community-edition (2.4.0)
  - Installing magento/project-community-edition (2.4.0): Loading from cache
Created project in C:\xampp\htdocs\magento24/
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - php-amqplib/php-amqplib v2.10.1 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
    - php-amqplib/php-amqplib v2.10.0 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
    - magento/product-community-edition 2.4.0 requires php-amqplib/php-amqplib ~2.10.0 -> satisfiable by php-amqplib/php-amqplib[v2.10.0, v2.10.1].
    - Installation request for magento/product-community-edition 2.4.0 -> satisfiable by magento/product-community-edition[2.4.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp\php\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

 

Re: Parse error: syntax error, unexpected ')'

just remove last comma for last row  

 

 public function getConfig()
    {
        // phpcs:disable
        $result = array_merge_recursive(
            include __DIR__ . '/../../../config/module.config.php',
            include __DIR__ . '/../../../config/router.config.php',
            include __DIR__ . '/../../../config/di.config.php',
            include __DIR__ . '/../../../config/states.install.config.php',
            include __DIR__ . '/../../../config/languages.config.php',
        );
        // phpcs:enable
        return $result;
    }
to be 
 public function getConfig()
    {
        // phpcs:disable
        $result = array_merge_recursive(
            include __DIR__ . '/../../../config/module.config.php',
            include __DIR__ . '/../../../config/router.config.php',
            include __DIR__ . '/../../../config/di.config.php',
            include __DIR__ . '/../../../config/states.install.config.php',
            include __DIR__ . '/../../../config/languages.config.php'
        );
        // phpcs:enable
        return $result;
    }

Re: Parse error: syntax error, unexpected ')'

If you getting this error then your cron is running as PHP 7.2 or less. You should double-check what version of PHP your cron/cli is run as.

 

Magento 2.4.x only supports PHP 7.3+ (Magento supports PHP 7.4.0. You can install Magento 2.4.0 with 7.3, but it is not tested or recommended. It is intended for upgrading from Magento 2.3.x to Magento 2.4.0.)

 

This is caused by a new feature in PHP 7.3: Trailing Commas in Function Calls

Developer @ magepal.com

Re: Parse error: syntax error, unexpected ')'

Hi have exact same query but unable to follow the step as I am not good at computers- I will really appreciate if someone can guide me step by step procedure or can email me on - khialaninancy@gmail.com . 

Re: Parse error: syntax error, unexpected ')'

o arquivo não pode ser modificado, outra alterntiva?


@mohamed_monged wrote:

just remove last comma for last row  

 

 public function getConfig()
    {
        // phpcs:disable
        $result = array_merge_recursive(
            include __DIR__ . '/../../../config/module.config.php',
            include __DIR__ . '/../../../config/router.config.php',
            include __DIR__ . '/../../../config/di.config.php',
            include __DIR__ . '/../../../config/states.install.config.php',
            include __DIR__ . '/../../../config/languages.config.php',
        );
        // phpcs:enable
        return $result;
    }
to be 
 public function getConfig()
    {
        // phpcs:disable
        $result = array_merge_recursive(
            include __DIR__ . '/../../../config/module.config.php',
            include __DIR__ . '/../../../config/router.config.php',
            include __DIR__ . '/../../../config/di.config.php',
            include __DIR__ . '/../../../config/states.install.config.php',
            include __DIR__ . '/../../../config/languages.config.php'
        );
        // phpcs:enable
        return $result;
    }

 

Re: Parse error: syntax error, unexpected ')'

You Need to update your php version Using this command update-alternatives --config php

then select php latest version which is supported by your magento version.