te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>apache - PHP response is escaping HTML characters and not rendering the frontend, but works fine in localdev environment - Stack
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

apache - PHP response is escaping HTML characters and not rendering the frontend, but works fine in localdev environment - Stack

programmeradmin3浏览0评论

The error (in production) looks like this:

The proper version, still working perfectly in local/dev environment is responding like this:

I think this bug was introduced as a side-effect of trying to set up some test Rust scripts (via curl --proto '=https' --tlsv1.2 -sSf | sh), which involved some work with Apache reverse proxies to try to get working in conjunction with a pre-existing PHP web app (dumb in retrospect?)

I've tried to uninstall those Apache mods, and remove the lines of code in my .conf files, but the error still persist.

Here are the HTTP headers from dev tools,

Production:

Request URL:
.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
164.92.119.217:443
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
no-cache, no-store, must-revalidate
connection:
Keep-Alive
content-encoding:
gzip
content-length:
1474
content-type:
text/html; charset=utf-8
date:
Tue, 18 Feb 2025 00:15:05 GMT
expires:
0
keep-alive:
timeout=5, max=100
pragma:
no-cache
server:
Apache/2.4.41 (Ubuntu)
vary:
Accept-Encoding
accept:
application/json, text/javascript, */*; q=0.01
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en-US,en;q=0.9
connection:
keep-alive
content-length:
25
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__stripe_mid=f221d5df-c6c1-4ad1-aa70-67c8556062e6efba90; personnel_id=1; PHPSESSID=2n0e902a3brd7hi2shcnuipjk2; __stripe_sid=588f6b12-46ff-4fe3-9e28-9618d07a46e0eac31d; cookie_random_string=ar00HbYeTINvqs7lmOgurFFZCKQSDjnd
host:
www.website
origin:

referer:

sec-ch-ua:
"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
"Windows"
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

Local:

Request URL:
http://localhost/app/ajax/entry/note/get-new-note-view.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
[::1]:80
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
no-store, no-cache, must-revalidate
connection:
Keep-Alive
content-length:
4540
content-type:
text/html; charset=UTF-8
date:
Tue, 18 Feb 2025 00:15:13 GMT
expires:
Thu, 19 Nov 1981 08:52:00 GMT
keep-alive:
timeout=5, max=98
pragma:
no-cache
server:
Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/8.0.2
x-powered-by:
PHP/8.0.2
accept:
application/json, text/javascript, */*; q=0.01
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en-US,en;q=0.9
connection:
keep-alive
content-length:
25
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__stripe_mid=9be9288f-f182-4059-aa0c-018babef617275e418; PHPSESSID=mcgb3t1spmuec3ue6fbj63egoi; personnel_id=1; cookie_random_string=jPuTmva9QCa0oROMhR8aQgYV92yPjUcq; __stripe_sid=0389a808-dfec-47f6-8720-47e74239fd4c2c79dd
host:
localhost
origin:
http://localhost
referer:
http://localhost/app?sec=new-note
sec-ch-ua:
"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
"Windows"
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

Any idea how to get my production output to match my local output? They are definitely using the same codebase, so it must be my Apache .conf, or some other config related to the Rust install I did?

Or what additional information I should provide?

(I tagged this question Rust and PHP, in case the solution is related to their respective configuration settings, or if installing Rust can alter the Apache/Linux web server configuration that affects existing PHP files).

The error (in production) looks like this:

The proper version, still working perfectly in local/dev environment is responding like this:

I think this bug was introduced as a side-effect of trying to set up some test Rust scripts (via curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh), which involved some work with Apache reverse proxies to try to get working in conjunction with a pre-existing PHP web app (dumb in retrospect?)

I've tried to uninstall those Apache mods, and remove the lines of code in my .conf files, but the error still persist.

Here are the HTTP headers from dev tools,

Production:

Request URL:
https://www.website/app/ajax/entry/note/get-new-note-view.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
164.92.119.217:443
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
no-cache, no-store, must-revalidate
connection:
Keep-Alive
content-encoding:
gzip
content-length:
1474
content-type:
text/html; charset=utf-8
date:
Tue, 18 Feb 2025 00:15:05 GMT
expires:
0
keep-alive:
timeout=5, max=100
pragma:
no-cache
server:
Apache/2.4.41 (Ubuntu)
vary:
Accept-Encoding
accept:
application/json, text/javascript, */*; q=0.01
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en-US,en;q=0.9
connection:
keep-alive
content-length:
25
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__stripe_mid=f221d5df-c6c1-4ad1-aa70-67c8556062e6efba90; personnel_id=1; PHPSESSID=2n0e902a3brd7hi2shcnuipjk2; __stripe_sid=588f6b12-46ff-4fe3-9e28-9618d07a46e0eac31d; cookie_random_string=ar00HbYeTINvqs7lmOgurFFZCKQSDjnd
host:
www.website
origin:
https://www.website
referer:
https://www.website/app?sec=new-note
sec-ch-ua:
"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
"Windows"
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

Local:

Request URL:
http://localhost/app/ajax/entry/note/get-new-note-view.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
[::1]:80
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
no-store, no-cache, must-revalidate
connection:
Keep-Alive
content-length:
4540
content-type:
text/html; charset=UTF-8
date:
Tue, 18 Feb 2025 00:15:13 GMT
expires:
Thu, 19 Nov 1981 08:52:00 GMT
keep-alive:
timeout=5, max=98
pragma:
no-cache
server:
Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/8.0.2
x-powered-by:
PHP/8.0.2
accept:
application/json, text/javascript, */*; q=0.01
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en-US,en;q=0.9
connection:
keep-alive
content-length:
25
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__stripe_mid=9be9288f-f182-4059-aa0c-018babef617275e418; PHPSESSID=mcgb3t1spmuec3ue6fbj63egoi; personnel_id=1; cookie_random_string=jPuTmva9QCa0oROMhR8aQgYV92yPjUcq; __stripe_sid=0389a808-dfec-47f6-8720-47e74239fd4c2c79dd
host:
localhost
origin:
http://localhost
referer:
http://localhost/app?sec=new-note
sec-ch-ua:
"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
"Windows"
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

Any idea how to get my production output to match my local output? They are definitely using the same codebase, so it must be my Apache .conf, or some other config related to the Rust install I did?

Or what additional information I should provide?

(I tagged this question Rust and PHP, in case the solution is related to their respective configuration settings, or if installing Rust can alter the Apache/Linux web server configuration that affects existing PHP files).

Share Improve this question asked Feb 18 at 0:23 HC_HC_ 1,06010 silver badges24 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Resolved: Fixed by disabling features in my VPN related to browser security. (omfg... (No coincidence that this happened right as my automated tests broke, due to unrelated changes))

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论