Skip to content
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

proof-of-cencept for calling wasm from php - not great, but probably ok as demo/example code? #519

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Jan 11, 2024

  1. Add an example that uses extism/extism

    https://github.com/extism/extism
    
    Buzz]$ make clean ; make ; sudo make install ; time php extismcpp.php
    rm -f extismcpp.so extismcpp.o
    sudo rm -f /usr/lib/php/20220829/extismcpp.so
    sudo rm -f /etc/php/8.2/cli/conf.d//extismcpp.ini
    g++ -Wall -c -O2 -std=c++11 -fpic -o extismcpp.o extismcpp.cpp
    g++ -shared -o extismcpp.so extismcpp.o -lphpcpp -lextism
    cp -f extismcpp.so /usr/lib/php/20220829
    cp -f extismcpp.ini /etc/php/8.2/cli/conf.d/
    Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
    ExtismClass::ExtismClass([no params])
    C++ reading wasm...
    reading WASM with read_file
    done WASM with read_file length:18258
    C++ reading wasm done.
    calling extism_function_new with hello_world
    calling extism_plugin_new with hello function
    sending a string to count to count_vowels...
    Hello from hello_world C++!
    0x7f6785c3535b
    hello_world:{"count": 6}[hello output done]
    print_plugin_output:{"count": 6}[output done]
    count_vowels plugin said:{"count": 6}12
    Freeing userdata
    ------------------------------
    LoadWASM count vowels result: {"count": 6}
    ------------------------------
    ExtismClass::__destruct
    ExtismClass::~ExtismClass
    
    real	0m0.037s
    user	0m0.019s
    sys	0m0.019s
    davidbuzz committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    4ad9397 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fed4da0 View commit details
    Browse the repository at this point in the history