* add ./create-rpm.sh file to build a "frankenphp" rpm package * also build a deb package * renamed to build-packages * linter... * add depends * linter again? * linter number 3 * linter number 4 * set default locations for ini file, conf files and extensions * set unified path for modules that should be ok on all dists * add default content into "package" folder * make file executable * worker is in public folder * what on earth did I do x) * use same FRANKENPHP_VERSION and make sure to let pr's run the rpm generation too (version 0.0.0) to see issues * install ruby, fpm and rpm-build * move to after changing base urls because it would fail with packages not found * ruby 3 build needs gcc 10 * rpm-build is necessary too... * and I forgot to link the package folder * create directories if they don't exist * copy out all frankenphp* files? * lint fix * only copy frankenphp-* files * only copy frankenphp-* files * the .deb file is name frankenphp_1.5.0... - create output folder instead and upload all things inside that will simplify things when later adding xdebug.so and ffi.so * update the last two steps to use the gh-output directory * add post install script to set frankenphp able to bind to port 80 for non-root users * dnf over yum, I think the yum alias was removed in RH 9.5 * newlines * newlines * add text what missing libcap means * copy php.ini-production from php-src, linter, update ruby version * move Caddyfile to /etc/frankenphp/Caddyfile * linter * fix a copy and paste error * better describe fallback to 0.0.0 * linter * copy installation scripts from official caddy packages, change user to frankenphp too * bombombom * make files executable * tabs * linter * linter again * use empty directory for three different destinations instead of keeping three empty local directories * caddy says the file is incorrectly formatted without these spaces * remove wildcard matcher from root directive * Apply suggestions from code review commit suggested changes to preinstall/postinstall scripts Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * Update dev.Dockerfile Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * remove misleading comment * update documentation for paths * update documentation for paths some more * fix musl opcache-jit issue * markdown linter * the damn tab * Apply suggestions from code review Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> * drop dev.Dockerfile php location from config.md * add php config note to CONTRIBUTING.md * dashes instead of asterisks in chinese docs * fix package building * create frankenphp user in case it doesn't exist for deb packages * create users if they don't exist, delete them again if they didn't exist * satisfy linter * create the user with the same commands as the postinst/preinstall scripts * Removes toolchain requirements. * trigger * Removes explicit calls to go get * trigger * setcap by default * simplify example project * bring page more in line with the caddy / apache / nginx default page * update to html 5 * oopsies * revert style to original * remove https:// (caddy uses http:// on RHEL, :80 on Debian) --------- Co-authored-by: Kévin Dunglas <kevin@dunglas.fr> Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
5.9 KiB
Katkıda Bulunmak
PHP Derleme
Docker ile (Linux)
Geliştirme Ortamı için Docker İmajını Oluşturun:
docker build -t frankenphp-dev -f dev.Dockerfile .
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 8080:8080 -p 443:443 -p 443:443/udp -v $PWD:/go/src/app -it frankenphp-dev
İmaj genel geliştirme araçlarını (Go, GDB, Valgrind, Neovim...) içerir ve aşağıdaki php ayar konumlarını kullanır
- php.ini:
/etc/frankenphp/php.iniVarsayılan olarak geliştirme ön ayarlarına sahip bir php.ini dosyası sağlanır. - ek yapılandırma dosyaları:
/etc/frankenphp/php.d/*.ini - php uzantıları:
/usr/lib/frankenphp/modules/
Docker sürümünüz 23.0'dan düşükse, derleme dockerignore pattern issue nedeniyle başarısız olacaktır. Dizinleri .dockerignore dosyasına ekleyin.
!testdata/*.php
!testdata/*.txt
+!caddy
+!internal
Docker olmadan (Linux ve macOS)
Kaynaklardan derlemek için talimatları izleyin ve --debug yapılandırma seçeneğini geçirin.
Test senaryolarını çalıştırma
go test -tags watcher -race -v ./...
Caddy modülü
FrankenPHP Caddy modülü ile Caddy'yi oluşturun:
cd caddy/frankenphp/
go build
cd ../../
Caddy'yi FrankenPHP Caddy modülü ile çalıştırın:
cd testdata/
../caddy/frankenphp/frankenphp run
Sunucu 127.0.0.1:8080 adresini dinliyor:
curl -vk https://localhost/phpinfo.php
Minimal test sunucusu
Minimal test sunucusunu oluşturun:
cd internal/testserver/
go build
cd ../../
Test sunucusunu çalıştırın:
cd testdata/
../internal/testserver/testserver
Sunucu 127.0.0.1:8080 adresini dinliyor:
curl -v http://127.0.0.1:8080/phpinfo.php
Docker İmajlarını Yerel Olarak Oluşturma
Bake (pişirme) planını yazdırın:
docker buildx bake -f docker-bake.hcl --print
Yerel olarak amd64 için FrankenPHP görüntüleri oluşturun:
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/amd64"
Yerel olarak arm64 için FrankenPHP görüntüleri oluşturun:
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/arm64"
FrankenPHP imajlarını arm64 ve amd64 için sıfırdan oluşturun ve Docker Hub'a gönderin:
docker buildx bake -f docker-bake.hcl --pull --no-cache --push
Statik Derlemelerle Segmentasyon Hatalarında Hata Ayıklama
-
FrankenPHP binary dosyasının hata ayıklama sürümünü GitHub'dan indirin veya hata ayıklama seçeneklerini kullanarak özel statik derlemenizi oluşturun:
docker buildx bake \ --load \ --set static-builder.args.DEBUG_SYMBOLS=1 \ --set "static-builder.platform=linux/amd64" \ static-builder docker cp $(docker create --name static-builder-musl dunglas/frankenphp:static-builder-musl):/go/src/app/dist/frankenphp-linux-$(uname -m) frankenphp -
Mevcut
frankenphpsürümünüzü hata ayıklama FrankenPHP çalıştırılabilir dosyasıyla değiştirin -
FrankenPHP'yi her zamanki gibi başlatın (alternatif olarak FrankenPHP'yi doğrudan GDB ile başlatabilirsiniz:
gdb --args frankenphp run) -
GDB ile sürece bağlanın:
gdb -p `pidof frankenphp` -
Gerekirse, GDB kabuğuna
continueyazın -
FrankenPHP'nin çökmesini sağlayın
-
GDB kabuğuna
btyazın -
Çıktıyı kopyalayın
GitHub Eylemlerinde Segmentasyon Hatalarında Hata Ayıklama
-
.github/workflows/tests.ymldosyasını açın -
PHP hata ayıklama seçeneklerini etkinleştirin
- uses: shivammathur/setup-php@v2 # ... env: phpts: ts + debug: true -
Konteynere bağlanmak için
tmatei etkinleştirin- name: Set CGO flags run: echo "CGO_CFLAGS=$(php-config --includes)" >> "$GITHUB_ENV" + - + run: | + sudo apt install gdb + mkdir -p /home/runner/.config/gdb/ + printf "set auto-load safe-path /\nhandle SIG34 nostop noprint pass" > /home/runner/.config/gdb/gdbinit + - + uses: mxschmitt/action-tmate@v3 -
Konteynere bağlanın
-
frankenphp.godosyasını açın -
cgosymbolizer'ı etkinleştirin- //_ "github.com/ianlancetaylor/cgosymbolizer" + _ "github.com/ianlancetaylor/cgosymbolizer" -
Modülü indirin:
go get -
Konteynerde GDB ve benzerlerini kullanabilirsiniz:
go test -tags watcher -c -ldflags=-w gdb --args frankenphp.test -test.run ^MyTest$ -
Hata düzeltildiğinde, tüm bu değişiklikleri geri alın
Misc Dev Resources
- uWSGI içine PHP gömme
- NGINX Unit'te PHP gömme
- Go (go-php) içinde PHP gömme
- Go'da PHP gömme (GoEmPHP)
- C++'da PHP gömme
- Sara Golemon tarafından PHP'yi Genişletme ve Yerleştirme
- TSRMLS_CC de neyin nesi?
- Mac'te PHP gömme
- SDL bağları
Docker ile İlgili Kaynaklar
Faydalı Komut
apk add strace util-linux gdb
strace -e 'trace=!futex,epoll_ctl,epoll_pwait,tgkill,rt_sigreturn' -p 1