Open joanhey opened 4 years ago
The problem was that in app.php
exist ' , changed ' to ".
And is working now.
But will be good if send an error.
The courious think is that when include a file in content_by_php
there are no problems if the file have '.
I like more { than '. But I understand that is not tecnically posible in php. But perhaps another tag will be better.
A question why work:
require "app.php";
and not;
require app.php;
The problem was that in
app.php
exist ' , changed ' to ". And is working now.But will be good if send an error. The courious think is that when include a file in
content_by_php
there are no problems if the file have '.
I think init_worker_by_php maybe have bugs in the implementation. Internally use zend api zend_eval_stringl_ex, it is best to give a simple and complete example.
https://github.com/TechEmpower/FrameworkBenchmarks/pull/5104 it's working. The app-async.php is for include the Mysql async pool. It's empty for you to add the code.
Now the php include the PDO connection in the init_worker_by_php
so don't need to reconnect every time.
The only problem was the ' in the app.php
.
WIll be good if init_worker_by_php
can include files with ' like do content_by_php
.
So we can include any php code.
Added project to openhub https://www.openhub.net/p/ngx_php7 You can sign and claim as manager of the project.
Now with the require app.php: Fortunes: 157.266 req/s
Now with the require app.php: Fortunes: 157.266 req/s
It should look like, abc code optimization improves performance. https://github.com/TechEmpower/FrameworkBenchmarks/pull/5104
Added project to openhub https://www.openhub.net/p/ngx_php7 You can sign and claim as manager of the project.
Done~
Like ngx_php don't use OpCache, any include
have a big impact.
It's like in your bench:
A simple Hello world if you include
the file versus inline
(or included in the init_worker), almost half the req/s.
For best performance, always include the app in the init_worker. But we need to use ' in the code, for include any php.
Also it's a better way to code all your app in app.php, than in the nginx config files.
Like ngx_php don't use OpCache, any
include
have a big impact.It's like in your bench:
A simple Hello world if you
include
the file versusinline
(or included in the init_worker), almost half the req/s.For best performance, always include the app in the init_worker. But we need to use ' in the code, for include any php.
The analysis is very clear, cool~
Also fixed the slow include now that use OPCache #72 .
Perhaps will be good to add part of that info in the README.
@joanhey Fixed by https://github.com/rryqszq4/ngx_php7/pull/78, Add directive init_worker_by_php_block
Hi, I want to
require
(include
) a file in theinit_worker_by_php
, but later I can't use the functions in the file.Example
And return this error:
Fatal error: Uncaught Error: Call to undefined function db() in ngx_php eval ...