Skip to content

bogkonstantin/php-extension-hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base PHP extension in C language with VSCode Debugger setup

Clone this repository and navigate to the directory.
Want to learn more about PHP extension development? Read more here.

Build image

docker build --pull --rm -f "Dockerfile" -t php-dev:latest "."

Run container

docker run --rm --name php-dev -it php-dev bash

Test function

Check if it works from inside the container:

php -r "echo hello_world() . PHP_EOL;"

Debug configuration for Visual Studio Code

VSCode launch config (tested on Mac M2). Use Docker Dev containers in VSCode

{
    "name": "Launch Test Function (gdb)",
    "type": "cppdbg",
    "request": "launch",
    "program": "/usr/local/bin/php",
    "args": [
        "-r",
        "echo hello_world() . PHP_EOL;",
    ],
    "cwd": ".",
    "MIMode": "gdb",
    "additionalSOLibSearchPath": "/php-src;/php-ext",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

About

Base PHP extension in C language with VSCode Debugger setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published