XreaでSimpfonyを動かす。
少し前に試してみて上手くいかなかった Symfonyのインストールを試みてみます。
まずは、Xreaのコントロールパネルから現在のIPアドレスを登録。sshで接続します。
ssh -l ユーザー ホスト
接続が成功したらまずはcomposerのインストール。
curl -sS https://getcomposer.org/installer | php
PHP Notice: Undefined variable: argv in – on line 13
PHP Stack trace:
PHP 1. {main}() -:0
Content-type: text/html; charset=UTF-8
All settings correct for using Composer
Downloading…
Composer (version 1.6.3) successfully installed to: /virtual/yam/composer.phar
Use it: php composer.phar
多少の警告は出たが、なんとかcomposerのインストールは完了。このまま、symfonyスケルトンを生成してみます。
/virtual/****/composer.phar create-project symfony/skeleton p1
んが、
Invalid argument supplied for foreach()
のエラーでストップ・・・前回はここで詰まった。良く良くエラーログを見てみると
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
<br />
CLI versionのPHPじゃないとダメ?
なんか無いかなと、PHPの他のパスで提供されていないかをlsコマンド叩いてみると、
-bash-4.2$ ls /usr/local/bin/php*
/usr/local/bin/php
/usr/local/bin/php-cgi
/usr/local/bin/php-config
/usr/local/bin/php-cs-fixer
/usr/local/bin/php-parse
/usr/local/bin/php-phpmyadmin-sql-parser-highlight-query
/usr/local/bin/php-phpmyadmin-sql-parser-lint-query
/usr/local/bin/php5
/usr/local/bin/php53
/usr/local/bin/php53cli
/usr/local/bin/php54
/usr/local/bin/php54cli
/usr/local/bin/php55
/usr/local/bin/php55cli
/usr/local/bin/php56
/usr/local/bin/php56cli
/usr/local/bin/php5cli
/usr/local/bin/php7
/usr/local/bin/php70
/usr/local/bin/php70cli
/usr/local/bin/php71
/usr/local/bin/php71cli
/usr/local/bin/phpab
/usr/local/bin/phpcli
/usr/local/bin/phpcov
/usr/local/bin/phpdbg
/usr/local/bin/phpdcd
/usr/local/bin/phpdoc
/usr/local/bin/phpdoc-md
/usr/local/bin/phpize
/usr/local/bin/phpspec
/usr/local/bin/phptrace
/usr/local/bin/phpui
/usr/local/bin/phpunit
/usr/local/bin/phpunit-skelgen
/usr/local/bin/phpunit6
結構、色々あるなあと。この中で一番それらしい、phpcliを使ってcurlで再びcomposerをインストールしてみる。
curl -sS https://getcomposer.org/installer | phpcli
こちらは成功した。しかし、相変わらずエラーが出る。
なんか無いかと検索してみると、
https://easyramble.com/composer-invoke-error.html
この様な記事が。まあ、それはそうだよねと、viを開いて次の様に打ち込み、composer.pharを呼び出すシェルスクリプトを準備します。
#!/usr/bin/env bash
/usr/bin/env /usr/local/bin/phpcli -d allow_url_fopen=On -d detect_unicode=Off /virtual/******/composer.phar $*
そのまま、composerという名前をつけ、chmod で0755に変更すると・・・
-bash-4.2$ /virtual/*******/composer create-project symfony/skeleton p1
Installing symfony/skeleton (v3.4.5)
– Installing symfony/skeleton (v3.4.5): Downloading (100%)
Created project in p1
Loading composer repositories with package information
Updating dependencies (including require-dev)
おお、おお動いた。しかし、
[Composer\Downloader\TransportException]
The “http://packagist.org/p/provider-latest%2424f7b1c28bd15f89edbf6e7e41344
ae850803e054b3362b6ff6dc7e012f045fd.json” file could not be downloaded (HTT
P/1.1 404 Not Found)
いやいや、ファイルが落とせ無いって・・・。もう一度諦めずに実行。
-bash-4.2$ /virtual/*****/composer create-project symfony/skeleton p1
Installing symfony/skeleton (v3.4.5)[InvalidArgumentException]
Project directory p1/ is not empty.create-project [-s|–stability STABILITY] [–prefer-source] [–prefer-dist] [–repository REPOSITORY] [–repository-url REPOSITORY-URL] [–dev] [–no-dev] [–no-custom-installers] [–no-scripts] [–no-progress] [–no-secure-http] [–keep-vcs] [–remove-vcs] [–no-install] [–ignore-platform-reqs] [–] [<package>] [<directory>] [<version>]
-bash-4.2$ /virtual/*****/composer create-project symfony/skeleton p1
Installing symfony/skeleton (v3.4.5)
– Installing symfony/skeleton (v3.4.5): Loading from cache
Created project in p1
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 23 installs, 0 updates, 0 removals
– Installing symfony/flex (v1.0.70): Downloading (100%)Prefetching 22 packages ????
– Downloading (100%)– Installing psr/log (1.0.2): Loading from cache
– Installing symfony/debug (v3.4.4): Loading from cache
– Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
– Installing symfony/console (v3.4.4): Loading from cache
– Installing symfony/routing (v3.4.4): Loading from cache
– Installing symfony/yaml (v3.4.4): Loading from cache
– Installing symfony/framework-bundle (v3.4.4): Loading from cache
– Installing symfony/http-foundation (v3.4.4): Loading from cache
– Installing symfony/event-dispatcher (v3.4.4): Loading from cache
– Installing symfony/http-kernel (v3.4.4): Loading from cache
– Installing symfony/finder (v3.4.4): Loading from cache
– Installing symfony/filesystem (v3.4.4): Loading from cache
– Installing psr/container (1.0.0): Loading from cache
– Installing symfony/dependency-injection (v3.4.4): Loading from cache
– Installing symfony/config (v3.4.4): Loading from cache
– Installing symfony/class-loader (v3.4.4): Loading from cache
– Installing psr/simple-cache (1.0.0): Loading from cache
– Installing psr/cache (1.0.1): Loading from cache
– Installing symfony/polyfill-apcu (v1.7.0): Loading from cache
– Installing symfony/cache (v3.4.4): Loading from cache
– Installing symfony/dotenv (v3.4.4): Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 4 recipes (06fd2ff2c37b007222e8c015660bb5a0)
– Configuring symfony/flex (>=1.0): From github.com/symfony/recipes:master
– Configuring symfony/framework-bundle (>=3.3): From github.com/symfony/recipes:master
– Configuring symfony/console (>=3.3): From github.com/symfony/recipes:master
– Configuring symfony/routing (>=3.3): From github.com/symfony/recipes:master
Executing script cache:clear [OK]
Executing script assets:install –symlink –relative public [OK]Some files may have been created or updated to configure your new packages.
Please review, edit and commit them: these files are yours.What’s next?
* Run your application:
1. Change to the project directory
2. Execute the php -S 127.0.0.1:8000 -t public command;
3. Browse to the http://localhost:8000/ URL.Quit the server with CTRL-C.
Run composer require server –dev for a better web server.* Read the documentation at https://symfony.com/doc
なんとか動いた。続きはまた明日。