Hello,

Download drupal:

C:\Projects\drupals\drupaldocker>composer create-project drupal/recommended-project:9.4.8

Created docker-compose.yml.

version: '3'
services:
  mysql:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=root
  drupal:
    image: drupal:latest
    ports:
      - 80:80
    volumes:
      - ./web:/var/www/html
      - ./vendor:/opt/drupal/vendor
      - ./composer.json:/opt/drupal/composer.json
      - ./composer.lock:/opt/drupal/composer.lock
    links:
      - mysql
    environment:
      - MYSQL_USERNAME=root
      - MYSQL_PASSWORD=root

Creating containers:

C:\Projects\drupals\drupaldocker>docker-compose up -d
[+] Running 3/3
 - Network drupaldocker_default     Created                                                                                                                                                                   0.7s
 - Container drupaldocker-mysql-1   Started                                                                                                                                                                   1.1s
 - Container drupaldocker-drupal-1  Started

Containers are running just fine.

Structure: https://ibb.co/GTQS6cw

http://localhost:8080/

This site can’t be reached

localhost refused to connect.

Try:

ERR_CONNECTION_REFUSED

How can I launch drupal? What am I doing wrong?

Thanks!

Comments

drupol’s picture

Updated the yml file:

From:

   ports:
      - 80:80

To

    ports:
      - 8080:80

http://localhost:8080/

Get this:

Forbidden

You don't have permission to access this resource.

Apache/2.4.54 (Debian) Server at localhost Port 8080


jaypan’s picture

Maybe try DDev. It has Drupal Docker templates in it, that are set up specifically for Drupal. It's what I use.

Contact me to contract me for D7 -> D10/11 migrations.

drupol’s picture

Spent all day to set up d9 with ddev. Finally it is working. 

Had to install ubuntu, ddev, docker. 

Gone thru a lot of troubleshooting. 

Browser spins long time. Other sites load just fine. Not sure why this local site takes longer time to load. 

Site:

https://ibb.co/0jmLQM1

Also enabled a module via drush for the first time ever. -)

C:\Projects\drupals\ddev-drupal9>ddev drush en paragraphs
The following module(s) will be enabled: paragraphs, entity_reference_revisions

 Do you want to continue? (yes/no) [yes]:
 > y

 [success] Successfully enabled: paragraphs, entity_reference_revisions

C:\Projects\drupals\ddev-drupal9>

Thanks!

drupol’s picture

Do you know why I get this error:

C:\Projects\drupals\ddev-drupal9>ddev composer require 'drupal/bootstrap_simple_carousel:^1.63'

In VersionParser.php line 521:

  Could not parse version constraint 1.63': Invalid version string "1.63'"


require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>...]

composer [require 'drupal/bootstrap_simple_carousel:1.63'] failed, composer command failed: exit status 1. stderr=
jaypan’s picture

Try removing the quotes:

ddev composer require drupal/bootstrap_simple_carousel:^1.63

Contact me to contract me for D7 -> D10/11 migrations.

drupol’s picture

Now I get this:

C:\Projects\drupals\ddev-drupal9>composer require drupal/bootstrap_simple_carousel:^1.63
The "1.63" constraint for "drupal/bootstrap_simple_carousel" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been updated
Running composer update drupal/bootstrap_simple_carousel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laminas/laminas-diactoros 2.14.0 requires php ^7.3 || ~8.0.0 || ~8.1.0 -> your php version (8.2.0) does not satisfy that requirement.
    - drupal/core-recommended 9.5.1 requires laminas/laminas-diactoros ~2.14.0 -> satisfiable by laminas/laminas-diactoros[2.14.0].
    - drupal/core-recommended is locked to version 9.5.1 and an update of this package was not requested.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

php version

C:\Projects\drupals\ddev-drupal9>php -version
PHP 8.2.0 (cli) (built: Dec  6 2022 15:31:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies

Extracted php zip to 

C:\php-8.0.27

Now I have two php folders

C:\php-8.0.27

C:\php-8.2.0

c

Not sure if downgrade php right or do I need to downgrade php?

C:\Projects\drupals\ddev-drupal9>ddev composer config platform.php 8.0.27

C:\Projects\drupals\ddev-drupal9>composer update
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading psr/container (1.1.1 => 1.1.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
    Failed to download psr/container from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:\php-8.2.0\php.ini
    Now trying to download from source
  - Syncing psr/container (1.1.2) into cache
  - Removing psr/container (1.1.1)
  - Installing psr/container (1.1.2): Cloning 513e0666f7 from cache
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating autoload files
48 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found

Was able to download and install the module. 

C:\Projects\drupals\ddev-drupal9>composer require drupal/bootstrap_simple_carousel:^1.63
The "1.63" constraint for "drupal/bootstrap_simple_carousel" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints
./composer.json has been updated
Running composer update drupal/bootstrap_simple_carousel
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking drupal/bootstrap_simple_carousel (1.63.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
    Failed to download drupal/bootstrap_simple_carousel from dist: The zip extension and unzip/7z commands are both missing, skipping.
The php.ini used by your command-line PHP is: C:\php-8.2.0\php.ini
    Now trying to download from source
  - Syncing drupal/bootstrap_simple_carousel (1.63.0) into cache
  - Installing drupal/bootstrap_simple_carousel (1.63.0): Cloning 8.x-1.63 from cache
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating autoload files
48 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found

C:\Projects\drupals\ddev-drupal9>ddev drush en bootstrap_simple_carousel
 [success] Successfully enabled: bootstrap_simple_carousel

System php version is 8.2 but I am not sure if php version for this site is 8.0. At this point, I am just confused with php version. Which php version my site is using? I also could not find any php.ini file under ddev directory. Not sure if I also need that file. 

jaypan’s picture

What does your composer.json look like?

Contact me to contract me for D7 -> D10/11 migrations.

drupol’s picture

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 9 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.9",
        "drupal/bootstrap_simple_carousel": "1.63",
        "drupal/core-composer-scaffold": "^9.5",
        "drupal/core-project-message": "^9.5",
        "drupal/core-recommended": "^9.5",
        "drupal/paragraphs": "^1.15",
        "drush/drush": "^11.4"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "config": {
        "allow-plugins": {
            "composer/installers": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true,
            "dealerdirect/phpcodesniffer-composer-installer": true
        },
        "sort-packages": true,
        "platform": {
            "php": "8.0.27"
        }
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/installing-drupal",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}
jaypan’s picture

Working through the following (I'll go through them in reverse):

    - laminas/laminas-diactoros 2.14.0 requires php ^7.3 || ~8.0.0 || ~8.1.0 -> your php version (8.2.0) does not satisfy that requirement.
    - drupal/core-recommended 9.5.1 requires laminas/laminas-diactoros ~2.14.0 -> satisfiable by laminas/laminas-diactoros[2.14.0].
    - drupal/core-recommended is locked to version 9.5.1 and an update of this package was not requested.

Drupal core is set to use 9.5.1, which requires laminas/laminas-diactoros  2.14.0, which requires PHP 7.3, 8.0 or 8.1. You are using PHP 8.2, which is not included in the laminas/laminas-diactoros requirements.

So you have two options, upgrade to a version of Drupal that is compatible with PHP 8.2 (Drupal 10 is compatible), or downgrade PHP to 8.1.

Contact me to contract me for D7 -> D10/11 migrations.

drupol’s picture

php version

C:\Projects\drupals\ddev-drupal9>php -version
PHP 8.2.0 (cli) (built: Dec  6 2022 15:31:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies

composer.json shows

        "platform": {
            "php": "8.0.27"
        }

I was able to install the module above only because I ran the command first:

C:\Projects\drupals\ddev-drupal9>ddev composer config platform.php 8.0.27

What would be the usage of php 8.0 mentioned in composer.json?

jaypan’s picture

php version

C:\Projects\drupals\ddev-drupal9>php -version
PHP 8.2.0 (cli) (built: Dec  6 2022 15:31:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies

Yes, you are running 8.2, and Drupal 9 is not compatible with PHP 8.2.

What would be the usage of php 8.0 mentioned in composer.json?

No idea.

Contact me to contract me for D7 -> D10/11 migrations.

drupol’s picture

Thank you!

cangurin limpiezas’s picture

For my old drupal 8 proyects i use
https://github.com/mogtofu33/docker-compose-drupal
works fine for me