To build it:
zig buildphpize./configuremake
To test it:
php -d extension=./modules/my_php_extension.so -r "echo hello_world();"
To build it:
zig buildphpize./configuremakeTo test it:
php -d extension=./modules/my_php_extension.so -r "echo hello_world();"
| [package] | |
| name = "hello_world" | |
| version = "0.1.0" | |
| edition = "2021" | |
| [lib] | |
| crate-type = ["cdylib"] | |
| [dependencies] | |
| anyhow = "*" |
| // For Zig 0.12 | |
| const std = @import("std"); | |
| const net = std.net; | |
| const ArenaAllocator = std.heap.ArenaAllocator; | |
| pub fn main() anyerror!void { | |
| var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | |
| const allocator = gpa.allocator(); |
All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.
| PASS=yourcertificatemasterpassword | |
| SUBJ=/C=PL/ST=MyState/L=MyLocation/O=MyOrganization/OU=MyOrganisationUnit/CN=localhost/emailAddress=admin@localhost | |
| # Targets | |
| localhostCA.crt: localhostCA.pem | |
| openssl x509 \ | |
| -in localhostCA.pem \ | |
| -inform PEM \ | |
| -out localhostCA.crt |
| const std = @import("std"); | |
| const net = std.net; | |
| const fs = std.fs; | |
| const os = std.os; | |
| pub const io_mode = .evented; | |
| pub fn main() anyerror!void { | |
| var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; | |
| const allocator = &general_purpose_allocator.allocator; |
| <?php | |
| function compileCPP(string $sourcePath, string $binaryPath): bool { | |
| $descriptorspec = [ | |
| 0 => ['pipe', 'r'], | |
| 1 => ['pipe', 'w'], | |
| 2 => ['pipe', 'w'] | |
| ]; | |
| $cwd = '/tmp'; |
| var net = require('net'); | |
| var sockets = []; | |
| var port = 8000; | |
| var guestId = 0; | |
| var server = net.createServer(function(socket) { | |
| // Increment | |
| guestId++; | |
| socket.nickname = "Guest" + guestId; |