Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119198 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25860 invoked from network); 22 Dec 2022 16:04:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Dec 2022 16:04:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1AD0F180539 for ; Thu, 22 Dec 2022 08:04:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_TEMPERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 52.96.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from MW2PR02CU002-vft-obe.outbound.protection.outlook.com (mail-westus2azon11013002.outbound.protection.outlook.com [52.101.49.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 22 Dec 2022 08:04:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fMHELWL7I43fi01Y54+5ouMBccQ2qVONRKlnqwsJK1HNfl/a7HOF3Zf2iGTM4Yy+z/Tj5rWF37OXZleQWbZLRcLZipQ1wG9qUj5UKQnw0gzn7IcRuz/taGAqlWdYm6A5rqppOtjYo8hLeZb6m+6t8rULTmgMHtMLrgblKhubpg4Cg8BVgwwbpX+AvGIiAvNwxf4yWk1laVjUyGaVy+uJ3p8K4Myrt5ZjhQyvzJ3x4bT0IKCshJVGyBjjGCAyMd8gl//9PXSxu8A1LyA/CNC2HfGxzx0Jge9p5OjPm4+Fhu1mSvg0Gw+X9RlXcrSipUNle3mKryAxTlPVyDG/siXDfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c5cytiNTNqoa3ckVnbOGCMO5jwTCmFFH0B7srB9qrmk=; b=HtJ2wq4DbJxT4+2va0GtTz52WYJRhPUnER2wOfJVbhgrdG2pMWmcmQJ+wpHe8cdd9aiX34D+Us/dv3jGSPt/grUXbXPdFUqiSAF9Gvj3+Q3kdCMTdSeFTsEaa4IdSqN6Kq/qAZh4hGI4JKtSgIhhtRE1NDQqVL9JOtdA2GT4YYS6iK9JqEu8U8IkEri+RLo9vGbnbB1HWH09tRjseERZXXMCjui+5zOysdC2lk3uciKwgDIsv717J0yW/WnVBXgrXfRlFu8QSF2Lvv3BW5pS2z9cRJ7bQKBEz7/L/gheoPqSHwC8ejvVDhyBvPjJhZ1Vjw7poeOzU8aLCFL3NAIT9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c5cytiNTNqoa3ckVnbOGCMO5jwTCmFFH0B7srB9qrmk=; b=qbtgJnm8+5Nmkxq6Vthcs8yUVUsMjSlqgHeU/H1WQaVrtG5c1FiXwm0Vdtdds9uGrtVtKOsbXKpRgihH7vzm5HlNXfX3uHm56QCNYCUl/pVejOC+1bLGkQNFZg4ftuG3qzCFAyYR4jMwlP/bzm6U6zVOZE2MkAfUElEaFuOhn8k= Received: from BLAPR05MB7314.namprd05.prod.outlook.com (2603:10b6:208:298::12) by DM6PR05MB5738.namprd05.prod.outlook.com (2603:10b6:5:108::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Thu, 22 Dec 2022 16:04:09 +0000 Received: from BLAPR05MB7314.namprd05.prod.outlook.com ([fe80::58fe:4b04:d5f4:66e2]) by BLAPR05MB7314.namprd05.prod.outlook.com ([fe80::58fe:4b04:d5f4:66e2%5]) with mapi id 15.20.5924.016; Thu, 22 Dec 2022 16:04:08 +0000 To: "internals@lists.php.net" CC: Asen Alexandrov Thread-Topic: PHP build for the wasm32-wasi target Thread-Index: AQHZFhquPA/5fy4qCk6mLUrvATxfZw== Date: Thu, 22 Dec 2022 16:04:08 +0000 Message-ID: Accept-Language: en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BLAPR05MB7314:EE_|DM6PR05MB5738:EE_ x-ms-office365-filtering-correlation-id: cc209e52-6426-43d7-9780-08dae4362899 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vXnDHrGoIRMfcKyZ6n/i2lJhK/3HbOwCuv0Sh8UF+r1Yc6oXxMQjFYyBiLLMDedhXA/Cvhjqr10DTHFFqueo537HLqao+YbwNdYr/mHcJihT67TxRHOg01vyVFn1x1YfcID84FHbLsOdvfZ0LJ8YQ9ByJYl0K+2MJVY/iZZ1UCOqs9hfmvjlu8ve2tjXHd3j3DrZksHcxq3rxM2AkFxkmpcIwjMsLNEzoOpf3Wn1VD2hTf4Ua/M+98KxQYlaumrTRvpnaKSvK46BsJjfiKNVhsp/IYvKj9K0OHMxuA6IFvOu3VUa7aAmFX3orgRXLUPhN3p4PjAlDxVwtXfGl+MZe5xcbE8lgWWYPDsEKGUlXGATBE5XTMzTKvBSASF0hQC0ZaCtqrfEnXl2Aej56SiadVzm4NvUGVnpuh9+EkwJ7JCrMq1dn2MGVASUAZ3t8dIUg5nxgrlRVsk+yW70WGJY3fhsE3VTi/ttLAeJKy0QaaFxdEaOgMWrH0Z0vzJPzUhGPB52Php27zWlzmBa23oN45KJr1xuRJSLC1yYLU2TXyl4oIO3OyQEnAPuhUPeWLzQUDHbdoDEBI2y2fPYMvS1alw+OGEL6XJlL3hj1fZXwqxKdJ4x6D6bT/ZiSTzgxrvO2JKk4xim+kHvRUZFyJHPNYT3UIq5nyFEOQor6TXv2WIMhXMMYwcYZu0GGNz5wpjCbiMIIBC4DHQGYG0gRRwfUU8KdOnGRTXimVlCuBKsriCnhJXaD8S42BkYcRgH+Mx/q70gqW7i5sUdjBDcVr1JICMlgu+E8KF9OR6/JxvKC1fZb9qXyENm3LB/wDiBjK+bye/0KxPCl5gpiiZ+ff6Jv9bkZhyLEFBAvsJi+ELs/Ms= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR05MB7314.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(366004)(396003)(376002)(39860400002)(451199015)(4326008)(7696005)(8676002)(41300700001)(21615005)(64756008)(2906002)(66476007)(6916009)(66899015)(66556008)(66946007)(107886003)(76116006)(66446008)(5660300002)(91956017)(52536014)(71200400001)(966005)(478600001)(6506007)(26005)(186003)(9686003)(86362001)(83380400001)(38100700002)(55016003)(66574015)(8936002)(38070700005)(316002)(16799955002)(166002)(33656002)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?XFZsRxjrdlQg+Q1/T4r/9eLxhk4vYs2ToI+mWISgasosvBUEoTp/rNpgK8?= =?iso-8859-1?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T1?= =?iso-8859-1?Q?ZAdqxcYBjOqpw7yNCKhkbP+I2x8Fy0xySQZFI0/2to+Kvpwy+2djPuhzVT?= =?iso-8859-1?Q?BlKOOQm7P4rNcrrC6sceAMAm6xreUdlaCJ0CMt4oP8Y/8Ld+wL3GumkAkw?= =?iso-8859-1?Q?K82QYhBcxTSS3s799HDCmGVEIYnpD9u1HDg25Jz06qRm86iDyE1+SiEeuT?= =?iso-8859-1?Q?NmBF/h4uINw3BkWwtdJps/yGAjlYOrg35TPtYWI2UZqnZKp0LIGByBQDsl?= =?iso-8859-1?Q?kQE2PIpGJRVVJlHnz7BpAw9GOp5UDiOFmvgU7kO5FeKZB859YlX6yHPJnS?= =?iso-8859-1?Q?9tPCHDslKmMQfp6UAqznxj8348lbYYUbinyQGl6Jfvf93SEATIdMhhWi2D?= =?iso-8859-1?Q?dt1FZUfCakw5m08jhauhIUQRI4Gyg7CMVizlOw9qY3Tvxjp/2pqTfjFv57?= =?iso-8859-1?Q?lu8UmzDvKfHJpLRW2GuaQDy9HgRnLxAkZq74IEBZSTNIg1CoG1iReCj789?= =?iso-8859-1?Q?HIqlmo3zd6wY2ab0n14JMi//2PE+C+Y7cGp3WSDlsnDWzMRHEAdDQ7wzY+?= =?iso-8859-1?Q?NPltVwtb2kZcf5SdTBAlmsGN/8Ez8bE15iGbKqcYlSOLgROgympTc3hrDM?= =?iso-8859-1?Q?vf71+N7v8I0ZY8ZXapT3U3ApZpWGrz4w7aEtCYFBtTZaRUqxH9VV4hOcGY?= =?iso-8859-1?Q?qUZSgSNg/6wjXWwnHjs2TRWLQYMmzYMNQLQDzEnb/RbSK9bfjWiiTIFA?= =?iso-8859-1?Q?=3D=3D?= Content-Type: multipart/alternative; boundary="_000_BLAPR05MB73147C8C5D378011C9291E38DAE89BLAPR05MB7314namp_" MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BLAPR05MB7314.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc209e52-6426-43d7-9780-08dae4362899 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Dec 2022 16:04:08.6554 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /8L0lVmAW54NpyMBA4B3j4sQkGur8PnOL6O/FaPexlZvM50ARoRM68Xl/jcRbaRJg0C2ejfu5bXs9YVRWkcrHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB5738 Subject: PHP build for the wasm32-wasi target From: rfernandezl@vmware.com (=?iso-8859-1?Q?Rafael_Fern=E1ndez_L=F3pez?=) --_000_BLAPR05MB73147C8C5D378011C9291E38DAE89BLAPR05MB7314namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello community, I am reaching out on behalf of the WasmLabs team at the Office of the CTO a= t VMware. We have been working on building PHP for WebAssembly, specifically for the = wasm32-wasi target. WASI [1] is a system interface that allows WebAssembly = to run on the server side by safely being able to access operating system-l= ike features, including files and filesystems, Berkeley sockets, clocks and= random numbers [2]. WebAssembly in the server side is experiencing a big growth both in interes= t and users. There are other programming language interpreters that can be = compiled to wasm32-wasi as of today; for example: Python [3] and Ruby [4]. We have patches for PHP 7.3.33 and 7.4.32 at the time of writing. Porting P= HP 8.2.0 is work in progress at this time. In the interest of getting feedback from the PHP community I am providing l= inks to the patches at GitHub. Please, let us know what would be the next s= tep to contribute and continue to maintain this work upstream. We look forw= ard to work with the PHP community. If you want to try it out, you can download the binaries we are producing i= n the CI/CD pipeline for 7.3.33 [5] and 7.4.32 [6]. You can use a WASI-enab= led WebAssembly runtime such as Wasmtime [7] to run PHP compiled to wasm32-= wasi. Patches: 7.3.33 [8], 7.4.32 [9][10]. Example execution: ``` $ wasmtime -- --dir ~/php-example php-cgi-7.4.32.wasm ~/php-example/hello/i= ndex.php X-Powered-By: PHP/7.4.32 Content-type: text/html; charset=3DUTF-8 Hello, world! ``` We have already presented some of this work at OSS conferences and events l= ike Kubecon and Docker Community days, and have written a few articles prov= iding the background to the port, its limitations and what can currently be= accomplished (including running WordPress!). Please find below some links = to the talks and articles: - Porting PHP to WebAssembly using WASI [11] - Running WordPress with WebAssembly using mod_wasm and Apache [12] - WebAssembly: Docker without containers! [13] - mod_wasm: Bringing WebAssembly to Apache [14]: this talk builds on top of= PHP 7.3.33 and shows WordPress running with sqlite on top of Apache, thank= s to an Apache module (mod_wasm) that is able to execute WebAssembly module= s. - Docker and WebAssembly, better together [15]: this presentation features = PHP 7.4.32 and explains a bit of the context of this work. Thank you, Rafael Fern=E1ndez L=F3pez. [1] https://wasi.dev/ [2] https://github.com/bytecodealliance/wasmtime/blob/03463458e426d4bd0601e= bd82e95b668fc982443/docs/WASI-intro.md [3] https://docs.python.org/3/whatsnew/3.11.html [4] https://www.ruby-lang.org/en/news/2022/12/06/ruby-3-2-0-rc1-released/ [5] https://github.com/vmware-labs/webassembly-language-runtimes/releases/t= ag/php%2F7.3.33%2B20221124-2159d1c [6] https://github.com/vmware-labs/webassembly-language-runtimes/releases/t= ag/php%2F7.4.32%2B20221124-2159d1c [7] https://wasmtime.dev/ [8] https://github.com/vmware-labs/webassembly-language-runtimes/tree/main/= php/php-7.3.33/patches [9] https://github.com/vmware-labs/webassembly-language-runtimes/blob/main/= php/php-7.4.32/patches/0001-Initial-port-of-7.3.33-patch-to-7.4.32.patch [10] https://github.com/vmware-labs/webassembly-language-runtimes/blob/main= /php/php-7.4.32/patches/0002-Fix-mmap-issues.-Add-readme.patch [11] https://wasmlabs.dev/articles/php-wasm32-wasi-port/ [12] https://wasmlabs.dev/articles/running-wordpress-with-mod-wasm/ [13] https://wasmlabs.dev/articles/docker-without-containers/ [14] https://www.youtube.com/watch?v=3DjXe8kulUscQ [15] https://youtu.be/yo30oF1Gflo?t=3D7361 --_000_BLAPR05MB73147C8C5D378011C9291E38DAE89BLAPR05MB7314namp_--