{"id":16,"date":"2026-11-21T12:01:00","date_gmt":"2026-11-21T12:01:00","guid":{"rendered":"https:\/\/php127.hazyhaar.fr\/blog\/?p=16"},"modified":"2026-11-22T04:03:16","modified_gmt":"2026-11-22T04:03:16","slug":"en-02-installing-php127","status":"publish","type":"post","link":"https:\/\/php127.hazyhaar.fr\/blog\/en-02-installing-php127\/","title":{"rendered":"Installing php127"},"content":{"rendered":"<p>php127 is a single binary. This article describes the build and execution modes used by the team, without assuming that readers have the code or binary. The quoted commands document internal operations, not a procedure to run. The historical description applies as of 2026-11-21, revision 11f6d94; it comes mainly from <code>cmd\/php127\/options.go<\/code>, which defines the options, <code>cmd\/php127\/main.go<\/code>, <code>cmd\/php127\/ini_options.go<\/code> and <code>sapi\/fpm\/config.go<\/code>.<\/p>\n<h2>Building the binary<\/h2>\n<p>php127 was a Go module requiring Go 1.27. The team built the binary without linking C libraries:<\/p>\n<pre><code>CGO_ENABLED=0 go build -o php127 .\/cmd\/php127\n<\/code><\/pre>\n<p>The resulting binary called no C library. Extensions were linked into the binary; the team checked its version and modules with the following commands:<\/p>\n<pre><code>.\/php127 -v\n.\/php127 -m\n<\/code><\/pre>\n<p>The first command printed <code>PHP 8.3.6 (cli) (php127 Go 1.27)<\/code>: php127 identified itself as PHP 8.3.6, the reference version. The second listed loaded modules, in the format of <code>php -m<\/code>. This list told the team which extensions were present.<\/p>\n<h2>The command line<\/h2>\n<p>The options followed those of PHP. The team ran a file by passing it as an argument or with <code>-f<\/code>, and a snippet of code with <code>-r<\/code>:<\/p>\n<pre><code>.\/php127 script.php arg1 arg2\n.\/php127 -r &#039;echo PHP_VERSION, &quot;\\n&quot;;&#039;\n.\/php127 -l script.php\n<\/code><\/pre>\n<p>The <code>-l<\/code> option checks the syntax without running anything. A directive is set with <code>-d key=value<\/code>, which can be repeated, and a configuration file is named with <code>-c<\/code>.<\/p>\n<p>One point differs from PHP and is worth knowing before any deployment: php127 does not look for a <code>php.ini<\/code> by default. The file is only read if <code>-c<\/code> names it (<code>cmd\/php127\/ini_options.go<\/code>); if <code>-c<\/code> points to a directory, php127 reads <code>php.ini<\/code> inside it, and a path that does not exist is ignored without a message. The options <code>-n<\/code>, <code>-q<\/code>, <code>-F<\/code>, <code>-O<\/code>, <code>--force-stderr<\/code>, <code>--nodaemonize<\/code> and <code>--allow-to-run-as-root<\/code> are accepted so that existing scripts keep working, but they have no effect.<\/p>\n<h2>The built-in HTTP server<\/h2>\n<p>As with <code>php -S<\/code>, the team could serve a directory over HTTP:<\/p>\n<pre><code>.\/php127 -S 127.0.0.1:8080 -t \/srv\/site\n<\/code><\/pre>\n<p>Without <code>-t<\/code>, the document root was the current directory. The code thus defined a built-in HTTP mode distinct from FastCGI; this description is not a load measurement.<\/p>\n<h2>FastCGI and FPM-style configuration<\/h2>\n<p>For FastCGI mode, the team used <code>-b<\/code>, or loaded a configuration in the PHP-FPM format with <code>-y<\/code> (or <code>--fpm-config<\/code>):<\/p>\n<pre><code>.\/php127 -b 127.0.0.1:PORT\n.\/php127 -y \/etc\/php127\/pool.conf\n.\/php127 -t -y \/etc\/php127\/pool.conf\n<\/code><\/pre>\n<p>The third line tests the file without starting the service; an invalid file makes the program exit with code 78. The modes exclude each other: <code>-S<\/code> cannot be combined with <code>-b<\/code> or <code>-y<\/code>, and <code>-r<\/code> cannot be combined with any server mode.<\/p>\n<p>The pool file understands the directives <code>listen<\/code>, <code>listen.allowed_clients<\/code>, <code>pm<\/code>, <code>pm.max_children<\/code>, <code>pm.max_requests<\/code>, <code>request_terminate_timeout<\/code>, <code>pm.status_path<\/code>, <code>ping.path<\/code> and <code>clear_env<\/code>, as well as the <code>env[\u2026]<\/code>, <code>php_value[\u2026]<\/code> and <code>php_admin_value[\u2026]<\/code> families. One difference matters for security: <code>user<\/code>, <code>group<\/code>, <code>chroot<\/code> and <code>security.limit_extensions<\/code> are accepted without error, but without effect (<code>sapi\/fpm\/config.go<\/code>). php127 therefore does not switch users and does not confine itself; it is up to the service manager to start it under the right account.<\/p>\n<h2>Behind nginx<\/h2>\n<p>The site that publishes this blog follows this layout: nginx accepts connections, terminates TLS, serves static files itself and hands PHP scripts to php127 through <code>fastcgi_pass<\/code> to a local address. Each application, the shop and the blog, has its own php127 process, its own system user and its own systemd unit, hardened with <code>NoNewPrivileges<\/code>, <code>ProtectSystem=strict<\/code>, <code>ProtectHome<\/code>, <code>PrivateTmp<\/code> and <code>PrivateDevices<\/code>. The MariaDB database listens on no network port; both applications reach it through the Unix socket.<\/p>\n<p>On the nginx side, php127 reads the script path from the FastCGI parameter <code>SCRIPT_FILENAME<\/code> (<code>sapi\/fpm\/env.go<\/code>); the rest comes down to the <code>fastcgi_pass<\/code> address:<\/p>\n<pre><code>location ~ \\.php$ {\n    include fastcgi_params;\n    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n    fastcgi_pass 127.0.0.1:PORT;\n}\n<\/code><\/pre>\n<p>Only nginx is described here, because it is the front end of this site. Another front end that speaks FastCGI should be configured the same way, but we have not measured it.<\/p>\n<h2>Blocking outbound traffic<\/h2>\n<p>At reference revision 5b31e86, <code>PHP127_BLOCK_EXTERNAL=1<\/code> makes cURL refuse addresses outside the loopback (<code>cmd\/php127\/services.go<\/code>, <code>extxmlcurl\/curl.go<\/code>). This check covers neither sockets nor the MySQL driver. The WordPress bench uses it alongside WordPress&#039;s own HTTP restrictions; it is not a process-wide firewall.<\/p>\n<h2>What installation does not do<\/h2>\n<p>Installation creates neither a database nor an account: WordPress and PrestaShop are then installed as usual, with their own setup wizards. Nor does it set <code>open_basedir<\/code> for you; the article on security explains what this directive covers in php127. Finally, remember that php127 has no PostgreSQL driver: an application that depends on it will not work.<\/p>\n<p class=\"php127-traduction\"><a rel=\"alternate\" hreflang=\"fr\" href=\"https:\/\/php127.hazyhaar.fr\/blog\/fr-02-installer-php127\/\">Lire en fran\u00e7ais<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>php127 is a single binary. This article describes the build and execution modes used by the team, without assuming that readers have the code or binary. The quoted commands document internal operations, not a procedure to run. The historical description applies as of 2026-11-21, revision 11f6d94; it comes mainly from cmd\/php127\/options.go, which defines the options, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-en"],"_links":{"self":[{"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":2,"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/posts\/16\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/php127.hazyhaar.fr\/blog\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}