2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PHPインストールしたら必須!パス+version確認+php.iniの初期設定をしよう!

Posted at

#PHPをインストールしよう
php5.6を公式サイトからインストール
コメント.png
ちなみに公式サイトでのインストールはntc,src以外の.zip形式をDLしました。

例:バージョン7.3の場合
1/21/2020 3:36 PM 28326466 php-7.3.14-src.zip
1/21/2020 3:36 PM 25729058 php-7.3.14-Win32-VC15-x64.zip //ここ
1/21/2020 3:36 PM 23972430 php-7.3.14-Win32-VC15-x86.zip //ここ
1/21/2020 10:49 PM 25951614 php-7.4.2-nts-Win32-vc15-x64.zip
1/21/2020 10:49 PM 24180393 php-7.4.2-nts-Win32-vc15-x86.zip

このDLしたファイルはCドライブのPHPフォルダの中に展開する

※環境変数でパスを通すC;/PHP

#PHPファイル初期設定(必須)

PHPのインストールしたフォルダを開いて、「php.ini-development」と「php.ini-production」があることを確認しましょう。

「php.ini-development」をリネームして「php.ini」に変更する

リネームした「php.ini」をテキストエディタで開いて以下の行のコメントアウトをはずす

##一ヶ所目

; extension_dir = "ext" extension_dir = "ext"に変更する

##二ヶ所目

;extension=opensslextension=opensslに変更する

当方、これを行わなかったのでcomposerコマンドで下記エラーが出たので初期設定は行うように

C:\Users\TOSHI>composer global require "Laravel/installer=~1.1"
Changed current directory to C:/Users/TOSHI/AppData/Roaming/Composer


  [Composer\Exception\NoSslException]
  The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl ex
  tension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

#php artisan -vでエラー

PHP Warning:  require(C:\Users\TOSHI\Desktop\app/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\TOSHI\Desktop\app\artisan on line 18

Warning: require(C:\Users\TOSHI\Desktop\app/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\TOSHI\Desktop\app\artisan on line 18
PHP Fatal error:  require(): Failed opening required 'C:\Users\TOSHI\Desktop\app/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\TOSHI\Desktop\app\artisan on line 18

Fatal error: require(): Failed opening required 'C:\Users\TOSHI\Desktop\app/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\TOSHI\Desktop\app\artisan on line 18

このようなエラーが表示されてしまいました。
調べて見るとcomposer installをするといいらしい

しかし・・・エラーが発生

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for league/flysystem 1.0.63 -> satisfiable by league/flysystem[1.0.63].
    - league/flysystem 1.0.63 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.


  Problem 2
    - league/flysystem 1.0.63 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - laravel/framework v6.13.1 requires league/flysystem ^1.0.8 -> satisfiable by league/flysystem[1.0.63].
    - Installation request for laravel/framework v6.13.1 -> satisfiable by laravel/framework[v6.13.1].

このエラーはfileinfoが必要ですと言われるのでphp.iniのfileinfoの部分をコメントアウトしてあげます。

;extension=fileinfoextension=fileinfo

すると、composer installが正常に実行されてphp artisan -vでlaravelのバージョンも確認できました!

###補足
php artisan -vを行う時はlaravelプロジェクトに移動してから!
例:C:\Users\ユーザー名\Desktop\app>cd
C:\Users\ユーザー名\Desktop\app

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?