2018-11-29 木 くもり
2018-11-28 水 くもり
ガストでコーディング。
デバッガーをいれたのでステップ実行していた。
やっぱりほしいぞ、物理ファンクションキー。
VS Code に PHP Debug 環境を構築したくなった。
はじめに
VS Code に PHP Debug 環境を構築したくなった。
四苦八苦しつつもなんとか環境ができた。
試行錯誤でどのような手順だったかはあいまいだが、うろおぼえの範囲で記録。
難所は pecl で xdebug がビルドできなかったところ。
原因とおもわれるところは
- phpize が OS X もしくは Xcode に既定でインストールされているものが実行されていたこと
- sudo で pecl を起動するとき、環境変数を引き継いで(preserve) していなかったこと
環境
kuwahara-mac:~ mitsuaki$ sw_vers ProductName: Mac OS X ProductVersion: 10.14.1 BuildVersion: 18B75
参考
How to Install XDebug on a new Mac (including Mojave) | Devin Baldwin
手順
xdebug ビルド
# link できないとエラーがでるが、後述の環境変数でフルパスで指定することで回避 $ brew install autoconf $ brew install automake # ソースからビルド(-s)しなくても大丈夫なのかもしれない $ brew install php@7.2 -s # brew でインストールしたpecl を使うために、bin ディレクトリへ移動 $ cd /usr/local/Cellar/php/7.2.12_1/bin $ export PHP_AUTOCONF=/usr/local/Cellar/autoconf/2.69/bin/autoconf $ export PHP_AUTOHEADER=/usr/local/Cellar/autoconf/2.69/bin/autoheader # うえの環境変数を引き継ぐために、-E つきで起動 $ sudo -E ./pecl install xdebug
php.ini
$ head -n 5 /usr/local/etc/php/7.2/php.ini zend_extension="xdebug.so" [XDebug] xdebug.remote_enable = 1 xdebug.remote_autostart = 1
httpd.conf
$ cat /usr/local/etc/httpd/httpd.conf | grep -E '^[^#].*(php|FilesMatch)' LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so <FilesMatch .php$> SetHandler application/x-httpd-php </FilesMatch>
launch.json
{ // IntelliSense を使用して利用可能な属性を学べます。 // 既存の属性の説明をホバーして表示します。 // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000, "pathMappings": { "/your-webapp-root": "${workspaceRoot}" } } ] }
xdebug ビルドがうまくいっていない例
kuwahara-mac:20181126 mitsuaki$ sudo pecl install xdebug WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update downloading xdebug-2.6.1.tgz ... Starting to download xdebug-2.6.1.tgz (283,961 bytes) ..........................................................done: 283,961 bytes 79 source files, building running: phpize grep: /usr/include/php/main/php.h: No such file or directory grep: /usr/include/php/Zend/zend_modules.h: No such file or directory grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory Configuring for: PHP Api Version: Zend Module Api No: Zend Extension Api No: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize' failed
PECL インストール
こちらのサイトをまねして PECL をインストール
Install PHP7, PECL, PEAR on MacOS - 長生村本郷Engineers'Blog
ログ
kuwahara-mac:20181126 mitsuaki$ sudo php -d detect_unicode=0 go-pear.phar Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /usr 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/bin 5. PHP code directory ($php_dir) : /usr/share/pear 6. Documentation directory : /usr/docs 7. Data directory : /usr/data 8. User-modifiable configuration files directory : /usr/cfg 9. Public Web Files directory : /usr/www 10. System manual pages directory : /usr/man 11. Tests directory : /usr/tests 12. Name of configuration file : /private/etc/pear.conf 1-12, 'all' or Enter to continue: ^C kuwahara-mac:20181126 mitsuaki$ sudo php -d detect_unicode=0 go-pear.phar Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /usr 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/bin 5. PHP code directory ($php_dir) : /usr/share/pear 6. Documentation directory : /usr/docs 7. Data directory : /usr/data 8. User-modifiable configuration files directory : /usr/cfg 9. Public Web Files directory : /usr/www 10. System manual pages directory : /usr/man 11. Tests directory : /usr/tests 12. Name of configuration file : /private/etc/pear.conf 1-12, 'all' or Enter to continue: 1 (Use $prefix as a shortcut for '/usr', etc.) Installation base ($prefix) [/usr] : /usr/local/pear Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /usr/local/pear 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/local/pear/bin 5. PHP code directory ($php_dir) : /usr/local/pear/share/pear 6. Documentation directory : /usr/local/pear/docs 7. Data directory : /usr/local/pear/data 8. User-modifiable configuration files directory : /usr/local/pear/cfg 9. Public Web Files directory : /usr/local/pear/www 10. System manual pages directory : /usr/local/pear/man 11. Tests directory : /usr/local/pear/tests 12. Name of configuration file : /private/etc/pear.conf 1-12, 'all' or Enter to continue: 4 (Use $prefix as a shortcut for '/usr/local/pear', etc.) Binaries directory [$prefix/bin] : /usr/local/bin Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /usr/local/pear 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/local/bin 5. PHP code directory ($php_dir) : /usr/local/pear/share/pear 6. Documentation directory : /usr/local/pear/docs 7. Data directory : /usr/local/pear/data 8. User-modifiable configuration files directory : /usr/local/pear/cfg 9. Public Web Files directory : /usr/local/pear/www 10. System manual pages directory : /usr/local/pear/man 11. Tests directory : /usr/local/pear/tests 12. Name of configuration file : /private/etc/pear.conf 1-12, 'all' or Enter to continue: Beginning install... Configuration written to /private/etc/pear.conf... Initialized registry... Preparing to install... installing phar:///Users/mitsuaki/20181126/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.3.tar... installing phar:///Users/mitsuaki/20181126/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.1.tar... installing phar:///Users/mitsuaki/20181126/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.5.tar... installing phar:///Users/mitsuaki/20181126/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar... installing phar:///Users/mitsuaki/20181126/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.4.2.tar... install ok: channel://pear.php.net/Archive_Tar-1.4.3 install ok: channel://pear.php.net/Console_Getopt-1.4.1 install ok: channel://pear.php.net/Structures_Graph-1.1.1 install ok: channel://pear.php.net/XML_Util-1.4.2 install ok: channel://pear.php.net/PEAR-1.10.5 PEAR: Optional feature webinstaller available (PEAR's web-based installer) PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) PEAR: To install optional features use "pear install pear/PEAR#featurename" ****************************************************************************** WARNING! The include_path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: </usr/local/pear/share/pear> If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working. Current include path : .: Configured directory : /usr/local/pear/share/pear Currently used php.ini (guess) : Press Enter to continue: The 'pear' command is now at your service at /usr/local/bin/pear ** The 'pear' command is not currently in your PATH, so you need to ** use '/usr/local/bin/pear' until you have added ** '/usr/local/bin' to your PATH environment variable. Run it without parameters to see the available actions, try 'pear list' to see what packages are installed, or 'pear help' for help. For more information about PEAR, see: http://pear.php.net/faq.php http://pear.php.net/manual/ Thanks for using go-pear! kuwahara-mac:20181126 mitsuaki$ which pecl /usr/local/bin/pecl kuwahara-mac:20181126 mitsuaki$ pecl version PEAR Version: 1.10.5 PHP Version: 7.1.19 Zend Engine Version: 3.1.0 Running on: Darwin kuwahara-mac.local 18.2.0 Darwin Kernel Version 18.2.0: Fri Oct 5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64 x86_64 kuwahara-mac:20181126 mitsuaki$
2018-11-23 金 はれ
bohemianrhapsody をみる
http://www.foxmovies-jp.com/bohemianrhapsody/
Freddie がインド人だったとは知らなかった
Freddie のステージ上での動きになんとも言えない違和感を感じていたが、
インド映画のダンサーの動きをおもいだすと妙に合点がいくものがある
彼の生き様から感じるのは、人を楽しませたいとおもう様に生まれたら、
おおいに人を楽しませる生き方をすればいいということだ
そのような生き方を止める人は、人を楽しませたいとおもう様には生まれてきてはいない
11月24日は 彼の命日だ