
macOS
搜索 ntunnel_sqlite.php 拷贝到服务器上


问题原因: ntunnel_sqlite.php 脚本第 235 行使用了 nil(if (conn==nil)),但PHP中不存在nil常量。PHP使用null。当脚本执行到这里时会抛出FatalError,导致HTTP500错误且没有任何输出。修复方法:将if(conn == nil)),但 PHP 中不存在 nil 常量。 PHP 使用 null。当脚本执行到这里时会抛出 Fatal Error,导致 HTTP 500 错误且没有任何输出。 修复方法: 将 if (conn==nil)),但PHP中不存在nil常量。PHP使用null。当脚本执行到这里时会抛出FatalError,导致HTTP500错误且没有任何输出。修复方法:将if(conn == nil) 改为 if ($conn === null) 验证:


bash
cat /etc/nginx/sites-available/navicat-tunnel
bash
server {
listen 8081;
listen [::]:8081;
server_name _;
root /www/sites/ntunnel_sqlite;
index ntunnel_sqlite.php;
location / {
try_files $uri $uri/ =404;
}
# PHP 处理
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
# 禁止访问隐藏文件
location ~ /\. {
deny all;
}
}
