Browse Source

[php] Mark update to v2 and enable JIT (#8181)

* Fix jit

* Update to v2

* Add worker name
Joan Miquel 2 years ago
parent
commit
6b16e59e1d

+ 1 - 1
frameworks/PHP/mark/composer.json

@@ -1,5 +1,5 @@
 {
 {
     "require": {
     "require": {
-        "mark-php/mark": "^1.1"
+        "mark-php/mark": "^v2"
     }
     }
 }
 }

+ 1 - 0
frameworks/PHP/mark/mark.dockerfile

@@ -18,6 +18,7 @@ ADD ./ /mark
 WORKDIR /mark
 WORKDIR /mark
 
 
 RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
 RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
+RUN sed -i "s|opcache.jit=off|opcache.jit=tracing|g" /etc/php/8.2/cli/conf.d/10-opcache.ini
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 

+ 3 - 1
frameworks/PHP/mark/start.php

@@ -7,6 +7,8 @@ require 'vendor/autoload.php';
 
 
 $api = new App('http://0.0.0.0:8080');
 $api = new App('http://0.0.0.0:8080');
 
 
+$api->name = "Mark";
+
 $api->count = (int) shell_exec('nproc');
 $api->count = (int) shell_exec('nproc');
 
 
 $api->any('/plaintext', function () {
 $api->any('/plaintext', function () {
@@ -27,7 +29,7 @@ $api->get('/json', function () {
 
 
 $date = gmdate('D, d M Y H:i:s').' GMT';
 $date = gmdate('D, d M Y H:i:s').' GMT';
 
 
-$api->onWorkerStart = function () {
+$api->onWorkerStart = static function () {
     Timer::add(1, function () {
     Timer::add(1, function () {
         global $date;
         global $date;
         $date = gmdate('D, d M Y H:i:s').' GMT';
         $date = gmdate('D, d M Y H:i:s').' GMT';