PHPãããã
About
ããã°ã©ãã³ã°è¨èªPHPã«é¢ããã¡ã¢ç¨ãã¼ã¸ã
- About
- reference
- php(1)
- å®è¡æ¹æ³
- ææ³
- PHPãWebãµã¼ãã¼ä¸ã§åä½ããä»çµã¿
- Ubuntuã¸ã®Install
- composer
- æè¡æ å ±ï¼æ¥æ¬èªã®ç»å£è³æ
reference
php(1)
-
php -a
ã§ã¤ã³ã¿ã©ã¯ãã£ãã·ã§ã«ã«å ¥ã php -r
ã§å¼æ°ã«æ¸¡ãããä»»æã®PHPå¦çãå®è¡ãã ex)php -r "echo 'hoge';"
php -m
ã§ä½¿ç¨å¯è½ãªãã¹ã¦ã®PHPã¢ã¸ã¥ã¼ã«ã®ä¸è¦§ãåºå
å®è¡æ¹æ³
ã¯ã³ã©ã¤ãã¼
- åè¿°ã®éãã
php -r
ã§PHPã®ã¯ã³ã©ã¤ãã¼å½¢å¼ã§ã®å®è¡ãã§ããã
PHPã¹ã¯ãªãã
- ã·ã§ã«ã¹ã¯ãªããã®ãããªæè¦ã§ãCLIã¹ã¯ãªãããå®è¡ãããã¨ãã§ããã
ææ³
ãã使ãé¢æ°
- var_dump https://online.dhw.co.jp/kuritama/function-tools-be-used-for-debugging-php/
- isset, unset http://vbnettips.blog.shinobi.jp/php/php%20æ¨æºé¢æ°ãã®2ã»å¤æ°ã®åå¨ãã§ãã¯åã³è§£é¤ã
åã·ã¹ãã
- å¤æ°å®£è¨æã«åã®å®£è¨ã¯å¼·å¶ãããªãã*1ã¾ããæé»çã«åå¤æãå®è¡ãããã
- PHP7ãããå³æ ¼ã«åãæ¤æ»ããstrict modeãå°å ¥ããã
åå空é
namespace
å½ä»¤ã§å®£è¨- ã¯ã©ã¹åã®è¡çªãé¿ããããã®æ©è½
- é層åãã§ãããããªãã¿ã«ã¯ããã¯ã¹ã©ãã·ã¥
\
ã使ããã - åä¸åå空éå ã§ããã°ãåå空é(ã¢ãã¬ã¹)ãçç¥ãã¦å¼ã³åºããã¨ãã§ãã
- è¨èªä¸ã®ã«ã¼ã«ã§ã¯ãªãããå®éã®ã¯ã©ã¹ãã¡ã¤ã«ãç½®ããã¦ããã¯ã©ã¹ãã¹ã¨åããããã¨ãæ¨å¥¨ããã¦ãã*2
use
㨠require_once
use
ã¯åå空éãæèããã®ã«å¯¾ããrequire_once
ã¯åå空éãæèããªã
ã¢ã³ãã¼ã¹ã³ã¢ããå§ã¾ãå¤æ°ã¯ä½ã
- ããããã® ->
$_COOKIE
$_hogehoge
- ã¹ã¼ãã¼ã°ãã¼ãã«å¤æ°ä»¥å¤ã®ãã¿ã¼ã³ã«ã¯æ©è½çãªæå³ã¯ãªã
ã¢ã³ãã¼ã¹ã³ã¢Ã2ããå§ã¾ãã¡ã½ããã¯ä½ã
- ããããã®ãâ
public function __set(string $name, mixed $value) : void {}
- ãã¸ãã¯ã¡ã½ããã¨å¼ã°ããã¿ã¤ãã®ã¡ã½ããã詳細ã¯ããç¬ç¿PHP 第4çãP555ãåç §
ã¨ã©ã¼ã¨ä¾å¤
PHPãWebãµã¼ãã¼ä¸ã§åä½ããä»çµã¿
apcheã¨NGINXã§ç°ãªã模æ§ãapacheã®å ´åã¯ä»¥ä¸ã
PHPãã¤ã³ã¹ãã¼ã«ããã¨èªåçã«PHPã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ããApacheã¯ããã©ã«ãã§ãã®PHPã¢ã¸ã¥ã¼ã«ãèªã¿è¾¼ã¿ã«ãã https://zenn.dev/bs_kansai/articles/3706c12408160c
ä¸è¨ã«è©²å½ããã®ã以ä¸ã¨æãããã
$ apache2ctl -M | grep -i php php7_module (shared)
ã¾ããphp-fpmã§åããå ´åã¯ãä¸è¨ã¨ã¯ç°ãªããã©ã¦ã¶ã¨å¥ããã»ã¹ã§PHPãå®è¡ãããã
https://qiita.com/kouki_o9/items/4a88cdc30c604373e9ac
Ubuntuã¸ã®Install
ã¾ããPPAãªãã¸ããªã追å ããã â»apache2ã使ãããã ondrej/apache2
ãå
¥ãã¦ã¿ããå¿
é ãã©ããã¯ããããã£ã¦ããªã
$ sudo add-apt-repository ppa:ondrej/php $ sudo add-apt-repository ppa:ondrej/apache2
次ã«PHP7.3ãinstallããåä½ç¢ºèªããã
$ sudo apt install php7.3 php7.3-common php7.3-cli php7.3-fpm php7.3-sqlite php7.3-mysql php7.3-dev php7.3-mbstring php7.3-zip php7.3-curl php7.3-gd php7.3-xml php7.3-intl php7.3-fpm $ php -v PHP 7.3.33-16+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Apr 11 2024 22:12:07) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.33-16+ubuntu22.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
composer
comoserã¯PHPã«ããã¦å©ç¨ãããããã±ã¼ã¸ããã¼ã¸ã£ã¼ã§ããã
installæ¹æ³
composerã®å ¬å¼ãã¼ã¸ã®æé ãå®æ½ããã
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" $ php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" Installer verified $ php composer-setup.php All settings correct for using Composer Downloading... Composer (version 2.7.3) successfully installed to: /tmp/composer.phar Use it: php composer.phar $ php -r "unlink('composer-setup.php');" $ sudo mv composer.phar /usr/local/bin/composer $ which composer /usr/local/bin/composer $ composer -v ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 2.7.3 2024-04-19 21:40:57 (ç¥)
æè¡æ å ±ï¼æ¥æ¬èªã®ç»å£è³æ
å¹´ã«ä¸åº¦ãPHP KAIGIã¨ããã«ã³ãã¡ã¬ã³ã¹ãéå¬ããã¦ãããç»å£è³æ&ã¢ã¼ã«ã¤ãåç»ãå ¬éããã¦ããã