dimanche 5 mai 2019

php artisan throws socket_connect() error

I'm trying to dockerize a php app and php artisan throws

root@61e76b4653f5:/var/www/projectname# php artisan optimize

  [ErrorException]                                                 
  socket_connect(): unable to connect [110]: Connection timed out  

when running any command (not only optimize). The app is up and running on a server and artisan works there. php -m gives the same output on both docker and server.

I have never used php before so I'm unsure how to debug this (which also means I'm not sure what information would be useful, please comment if I'm missing something).

docker:

PHP 7.0.33 (cli) (built: Dec 29 2018 06:56:56) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies

server:

PHP 7.0.33-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies

composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "predis/predis": "~1.0",
        "laravelcollective/html": "5.2.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "vendor"
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire