Comments (12)
Change access_by_php to rewrite_by_php, I found it is ok.
... set $sel 0; location = / { rewrite_by_php ' $x = 1; ngx_var::set("sel", $x); '; return 200 $sel; } ...
Oh I so happy, this worked thanks dude, i love u <3 @rryqszq4
from ngx-php.
@fatalafitili
I tested that the access_by_php directive was not executed.Need to research in depth.
from ngx-php.
@rryqszq4 I wait u
from ngx-php.
@fatalafitili
The 'return' directive is in the 'rewrite' phase, earlier than the 'access' phase.
Try the following example:
...
set $sel 0;
location = / {
access_by_php '
$x = 1;
ngx_var::set("sel", $x);
';
content_by_php '
echo ngx_var::get("sel");
';
}
...
from ngx-php.
@fatalafitili
The 'return' directive is in the 'rewrite' phase, earlier than the 'access' phase.Try the following example:
... set $sel 0; location = / { access_by_php ' $x = 1; ngx_var::set("sel", $x); '; content_by_php ' echo ngx_var::get("sel"); '; } ...
I know it works but I want to change a variable in nginx.
for example
`set $sel 0;
location = / {
access_by_php '
$x = 1;
ngx_var::set("sel", $x);
';
content_by_php '
echo ngx_var::get("sel");
';
if ($sel = 1) {
#I want to make transactions here
}
}`
@rryqszq4 Isn't it possible ?
from ngx-php.
@fatalafitili
For example about what transactions?
from ngx-php.
@rryqszq4
My only goal is to change the value of a nginx variable with php,
I can use that variable in all fields, usually if parameter
from ngx-php.
@fatalafitili
I think the ‘rewrite_by_php’ directive should be used, but there are some bugs.
=.=
from ngx-php.
Okay, buddy, I'm gonna do it for now, but I'm waiting for an update. :)
from ngx-php.
Change access_by_php to rewrite_by_php, I found it is ok.
...
set $sel 0;
location = / {
rewrite_by_php '
$x = 1;
ngx_var::set("sel", $x);
';
return 200 $sel;
}
...
from ngx-php.
Hello dude i again here :) my problem is not fully solved, look this;
it's not complete, but it's logic
i did use this but this is not worked, 404 does not;
i need this:
Example:
(php counts how many times each user enters)
php variable if 100, nginx variable 1 do
if nginx variable 1, go return 404 else go location /
i need to do this, can u help again me ? @rryqszq4
from ngx-php.
That's the right logic, but it doesn't work;
from ngx-php.
Related Issues (20)
- ngx_request_headers does not get all headers
- ngx_var_get causes nginx to core dump
- [enhancement] Add a timer event
- Simple Demo, Microblog using NGX-PHP (PHP8) and Docker HOT 2
- ngx-php dockerfile need upgrade HOT 4
- rocky linux 8 + php 8.0 + nginx 1.23.1 HOT 4
- Fail with PHP 8.2 HOT 3
- Concrete example from standard nginx.conf? HOT 6
- [Question] Ngx-php internally use forks or threads ? HOT 3
- 一些指令怎么使用呢?没有说明啊
- Async Mysql fail only in this repo :/
- Fix var_dump in tests
- [question] What is the difference with or without _block HOT 1
- Create new release HOT 2
- [question] Can we use ngx_socket_connect() to an upstream? HOT 3
- is this support AWS Linux 2 and PHP 8.2.X
- Ngx-php added as supported SAPI in PHP8.3 HOT 5
- Error inlcude file (cannot declare class) HOT 3
- ngx_var_get nginx Signal 11 HOT 4
- Request body > 10kb not response HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-php.