-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] about franken on windows #880
Comments
Well done. I think you can upload a binary package thus we can test it. |
Thank you very much for working on this! Could you give us the steps you followed? |
https://drive.google.com/drive/folders/12niHlETBT_Inb3XE2QKkoRdro_7YpTIh The demo product is larger than 25MB, so I put it on google drive first. |
It takes a while to organize the code, and right now it's implemented in an ugly way.
The exact steps and code come later. |
Could building against https://github.com/jart/cosmopolitan be helpful in this scenario? |
Cool project. I'll see if it bridges to cgo, after I port run-tests.php to frankenphp. And I'll let you know if I make any progress on it. |
Build frankenphp on windowsBuild tool-chainMake sure that you have a development environment could make php source build complete( # CMD that in php SDK environment
cd php-src\x64\Release_TS
php -i How I setup php SDKInstall visual studio 2022You can also install visual studio 2019 to follow php windows build manal strictly. If not, install vs2022, make sure you follow [php SDK README #Requirements](https://github.com/php/php-sdk-binary-tools/blob/master/README.md#Requirements), install the module that needed. Next, install the other tools mention by [php SDK README ##Other tools](https://github.com/php/php-sdk-binary-tools/blob/master/README.md#other-tools). Most of them could installed by package manager, and few of them need to install by hand. Set up php SDK# recommand use powershell, the windows default one.
git clone https://github.com/php/php-sdk-binary-tools.git c:\php-sdk
cd C:\php-sdk
git checkout php-sdk-2.2.0
phpsdk-vs16-x64.bat
# now in CMD that in php SDK environment, after execute .bat above. # CMD that in php SDK environment
phpsdk_buildtree phpdev
# now in C:\php-sdk\phpdev\vs16\x64
git clone https://github.com/php/php-src.git
cd php-src
phpsdk_deps -b 8.3 -u
git checkout php-8.3.7
git checkout -b d8.3.7
buildconf
configure
nmake
cd x64\Release_TS
php -i
# now in C:\php-sdk\phpdev\vs16\x64
git clone https://github.com/php/php-src.git
cd php-src
git checkout php-8.3.7
git checkout -b d8.3.7
buildconf
configure
nmake
cd x64\Release_TS
php -i If its output like it should to be, you PHP SDK is complete. Build php libs and headersIf you follow the step ##How I setup php SDK, you need clean repository.
Clone fputils and apply php-patch
configure, nmake, nmake build-devel
We need And you could also do some checks on those dlls, ensure that the symbols what we need is exported.
Prepare Msys2 environmentClick [msys2-x86_64-20240507.exe](https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-x86_64-20240507.exe) dowload and install it. We use environment MINGW64/MSYS2. Install basic tools# mingw64/msys2 bash
pacman -S git
pacman -S vim
pacman -S make
pacman -S wget Install gcc# mingw64/msys2 bash
pacman -U https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-13.2.0-6-any.pkg.tar.zst Setup go# mingw64/msys2 bash
cd
mv /c/fputils/go /mingw64/lib
cp /c/fputils/go/bin/*.exe /mingw64/bin Set go environment variables# mingw64/msys2 bash
vim ~/.bashrc Add the following two lines to your .bashrc. # ~/.bashrc
export GOROOT=/mingw64/lib/go
export GOPATH=C:\\Users\\your user name\\go then # mingw64/msys2 bash
source ~/.bashrc If you feel some go env is wrong, just modify it adapt to your environment. Mine blow:
Install brotli# mingw64/msys2 bash
pacman -S mingw-w64-x86_64-brotli Frankenphp dependenciesSet libsCopy your # migw64/msys2 bash
cp /c/php-sdk/phpdev/vs16/x64/php-src/x64/Release_TS/*.dll /usr/local/lib Copy your # mingww64/msys2 bash
cp /mingw64/lib/libbrotlicommon.a /mingw64/lib/libbrotlidec.a /mingw64/lib/libbrotlienc.a /usr/local/lib Set headersCopy all things that under your # mingww64/msys2 bash
cp /c/php-sdk/phpdev/vs16/x64/php-src/x64/Release_TS/php-8.3.7-devel-vs16-x64/include/* /usr/local/include/php then modify // orign line 95
typedef int pid_t;
// modify it to
typedef long long pid_t; Prepare and build frankenphpClone and make new branch# mingw64/msys2 bash
cd
git clone https://github.com/dunglas/frankenphp.git
cd frankenphp
git checkout v1.1.5
git checkout -b d1.1.5 Patch# mingw64/msys2 bash
# in ~/frankenphp
cp -r /c/fputils/fp-patch ./
git am --abort
git am fp-patch/*.patch BuildIf your msys2 has installed in default path, and you followed my step, now you can build. # mingw64/msys2 bash
cd ~/frankenphp
cd caddy/frankenphp
make build
# for clean
make clean If not, like you installed msys2 in some where other, check the Run demoOk, we got frankenphp built, now we could run some demo. PhpinfoTime for a classic session. Copy you # mingw64/msys2 bash
tree phpinfo/ output:
# mingw64/msys2 bash
./frankenphp php-server Now access 127.0.0.1:80 . AdminerAdminer is an opensource, singal file, mutli-db-supported db manager. Its nice to use it as a demo. # mingw64/msys2 bash
wget https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php If you follow steps above, the exts we have now are just right for running adminer. And steps same to ##phpinfo, just rename adminer.php to index.php. Zentao PMSZentao PMS is an opensource project management software, a lit bit more complicated than adminer. Its also need more php extensions, this section want to make frankenphp on windows to server bigger project. Rebuild php-srcWe need more php exts to supprot zentao pms, so rebuild php-src. If you have closed terminal that build php-src, you should inital it again. cd C:\php-sdk
phpsdk-vs16-x64.bat
# now in CMD that in php SDK environment, after execute .bat above. cd phpdev\vs16\x64\php-src
nmake clean-all
configure --disable-all --enable-zts --enable-embed --enable-cli --disable-opcache-jit --without-pcre-jit --enable-session --with-mysqlnd --enable-pdo --with-pdo-mysql --enable-filter --enable-mbstring --enable-zlib --with-gd --with-iconv --with-openssl --with-curl --enable-ctype
cd c:\fputils
frankenphp.exe php-cli modify-makefile.php "C:\php-sdk\phpdev\vs16\x64\php-src\Makefile"
nmake
nmake build-devel Then, follow the section #Frankenphp dependencies. Rebuild frankenphp# mingw64/msys2 bash
cd ~/frankenphp/caddy/frankenphp
make clean
make build Run Zentao PMS# mingw64/msys2 bash
mkdir ~/zentao
cd zentao
wget https://github.com/easysoft/zentaopms/archive/refs/tags/zentaopms_18.12.tar.gz
tar -zxvf zentaopms_18.12.tar.gz
cp ~/frankenphp/caddy/frankenphp/frankenphp.exe ./
cp /usr/local/lib/*.dll ./
# copy dll that need by php8ts.dll
cp /c/php-sdk/phpdev/vs16/x64/deps/bin/libcrypto-3-x64.dll ./
cp /c/php-sdk/phpdev/vs16/x64/deps/bin/libssh2.dll ./
cp /c/php-sdk/phpdev/vs16/x64/deps/bin/libssl-3-x64.dll ./
cp /c/php-sdk/phpdev/vs16/x64/deps/bin/nghttp2.dll ./
# copy extension php_openssl
mkdir ext
cp /c/php-sdk/phpdev/vs16/x64/php-src/x64/Release_TS/php_openssl.dll ./ext/
vim php.ini
# >> add 2 line
# extension_dir="C:\msys64\home\*your username*\zentao\ext"
# extension=php_openssl.dll
# >> 2 line end
# run zentao pms
./frankenphp.exe php-server --root zentaopms/www Now you will see install page. TestI've modified the php-src/run-tests.php to fit frankenphp, like frankenphp no need to run sapi tests. So far I've only tested frankenphp with no ext. Even so, I didn't modify run-tests.php to the point where it adapts perfectly to frankenphp, there still some tests failed but not frankenphp's problem. Modify run-tests.php is a boring job. Rebuild php with no extIf you have closed terminal that build php-src, you should inital it again. cd C:\php-sdk
phpsdk-vs16-x64.bat
# now in CMD that in php SDK environment, after execute .bat above. cd phpdev\vs16\x64\php-src
nmake clean-all
configure --disable-all --enable-zts --enable-embed --enable-cli --disable-opcache-jit --without-pcre-jit
cd c:\fputils
frankenphp.exe php-cli modify-makefile.php "C:\php-sdk\phpdev\vs16\x64\php-src\Makefile"
nmake
nmake build-devel Then, follow the section #Frankenphp dependencies. Rebuild frankenphp# mingw64/msys2 bash
cd ~/frankenphp/caddy/frankenphp
make clean
make build Copy filesCopy frankenphp.exe php8ts.dll php8embed.dll into php-src # mingw64/msys2 bash
cp ~/frankenphp/caddy/frankenphp/frankenphp.exe /c/php-sdk/phpdev/vs16/x64/php-src
cp /c/php-sdk/phpdev/vs16/x64/php-src/x64/Release_TS/*.dll /c/php-sdk/phpdev/vs16/x64/php-src Make patchIf follow section #(Build php libs and headers) you already use all patches. If not the patch that modify is 0002-modify-run-tests.php.patch . Run-tests# mingw64/msys2 bash
cd /c/php-sdk/phpdev/vs16/x64/php-src
./frankenphp php-cli run-tests.php I remember 89% passed. |
@TenHian |
Describe you feature request
I've build a frankenphp.exe on windows
After modifying some code in php-src and some code in c-thread-pool and some code in frankenphp, I came up with a windows version of minimal frankenphp(barely tested). It still uses dynamic links now. Maybe in the future I'll modify it to make it static (larger change). It now does not contain any php extensions, only the core functionality.
Barely tested
I ran some basic tests on the php-cli, like some scripts that only use the core extension. And ran phpinfo on php-server. However these tests are minimal. So I recalled
php-src/run-tests.php
.Hassles
As comprehensive as these tests are, they're not ready to run straight away, and it looks like I'm going to have to make some modifications to it(frankenphp php-cli is different from php.exe). So I read the script. Then it tells me at line 2300+, "OK, we've taken care of all the pre-conditions, now we should run the tests!". When I reached this point, I muttered to myself, "Wait, buddy, what were the prerequisites we dealt with before?". This script is pretty good, honestly. But its two big big functions and numerous pre-conditions made me dizzy. I'd even like to see what it those
.phpt
have to test and write a script myself. This will less suffering.And more
#83 #420
Now I understand why some people give up after trying for a while.
End
I need to take a nap for a while. Anyway, I will persist on it. If you have any ideas about testing franken's integrity on Windows, kick me.
The text was updated successfully, but these errors were encountered: