国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

二進(jìn)制打包

webman支持將項(xiàng)目打包成一個(gè)二進(jìn)制文件,這使得webman無需php環(huán)境也能在linux系統(tǒng)運(yùn)行起來。

注意
打包后的文件目前只支持運(yùn)行在x86_64架構(gòu)的linux系統(tǒng)上,不支持windows和mac系統(tǒng)
需要關(guān)閉php.ini的phar配置選項(xiàng),既設(shè)置 phar.readonly = 0

安裝命令行工具

composer require webman/console ^1.2.24

打包

運(yùn)行命令

php webman build:bin

同時(shí)可以指定以哪個(gè)php版本打包,例如

php webman build:bin 8.1

打包后會(huì)在bulid目錄生成一個(gè)webman.bin文件

啟動(dòng)

將webman.bin上傳至linux服務(wù)器,執(zhí)行 ./webman.bin start./webman.bin start -d 即可啟動(dòng)。

原理

  • 首先將本地webman項(xiàng)目打包成一個(gè)phar文件
  • 然后遠(yuǎn)程下載php8.x.micro.sfx到本地
  • 將php8.x.micro.sfx和phar文件拼接為一個(gè)二進(jìn)制文件

注意事項(xiàng)

  • 強(qiáng)烈建議本地php版本和打包版本一致,例如本地是php8.1,打包也用php8.1,避免出現(xiàn)兼容問題
  • 打包會(huì)下載php8的源碼,但是并不會(huì)本地安裝,不會(huì)影響本地php環(huán)境
  • webman.bin目前只支持在x86_64架構(gòu)的linux系統(tǒng)運(yùn)行,不支持在mac系統(tǒng)運(yùn)行
  • 打包后的項(xiàng)目不支持reload,更新代碼需要restart重啟
  • 默認(rèn)不打包env文件(config/plugin/webman/console/app.php中exclude_files控制),所以啟動(dòng)時(shí)env文件應(yīng)該放置與webman.bin相同目錄下
  • 運(yùn)行過程中會(huì)在webman.bin所在目錄生成runtime目錄,用于存放日志文件
  • 目前webman.bin不會(huì)讀取外部php.ini文件,如需要自定義php.ini,請(qǐng)?jiān)?/config/plugin/webman/console/app.php 文件custom_ini中設(shè)置
  • 有些文件不需要打包,可以設(shè)置config/plugin/webman/console/app.php排除掉,避免打包后的文件過大
  • 二進(jìn)制打包不支持使用swoole協(xié)程
  • 切勿將用戶上傳的文件存儲(chǔ)在二進(jìn)制包中,因?yàn)橐?code>phar://協(xié)議操作用戶上傳的文件是非常危險(xiǎn)的(phar反序列化漏洞)。用戶上傳的文件必須單獨(dú)存儲(chǔ)在包之外的磁盤中。
  • 如果你的業(yè)務(wù)需要上傳文件到public目錄,需要將public目錄獨(dú)立出來放在webman.bin所在目錄,這時(shí)候需要配置config/app.php如下并重新打包。
    'public_path' => base_path(false) . DIRECTORY_SEPARATOR . 'public',

單獨(dú)下載靜態(tài)PHP

有時(shí)候你只是不想部署PHP環(huán)境,只需要一個(gè)PHP可執(zhí)行文件,點(diǎn)擊請(qǐng)點(diǎn)擊這里下載靜態(tài)php下載

提示
如需給靜態(tài)php指定php.ini文件,請(qǐng)使用以下命令 php -c /your/path/php.ini start.php start -d

支持的擴(kuò)展

Core, date, libxml, openssl, pcre, sqlite3, zlib, amqp, apcu, bcmath, calendar, ctype, curl, dba, dom, sockets, event, hash, fileinfo, filter, gd, gettext, json, iconv, SPL, session, standard, mbstring, igbinary, imagick, exif, mongodb, msgpack, mysqlnd, mysqli, pcntl, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pdo_sqlsrv, pgsql, Phar, posix, readline, redis, Reflection, shmop, SimpleXML, soap, sodium, sqlsrv, sysvmsg, sysvsem, sysvshm, tokenizer, xlswriter, xml, xmlreader, xmlwriter, xsl, zip, memcache, Zend OPcache

項(xiàng)目出處

https://github.com/crazywhalecc/static-php-cli
https://github.com/walkor/static-php-cli

編輯于2025-06-01 16:49:38 完善本頁 +發(fā)起討論
贊助商