1. The API responds with a 500 error. See Figure 1.

2. Check the Nginx error log. Error: PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/object/src/vendor/autoload.php) is not within the allowed path(s): See Figure 2.

2025/03/11 10:46:31 [error] 323148#0: *3 FastCGI sent in stderr: "PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/object/src/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/object/src/api/web/:/tmp/:/proc/) in /home/wwwroot/object/src/api/web/index.php on line 6PHP message: PHP Warning: require(/home/wwwroot/object/src/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/object/src/api/web/index.php on line 6PHP message: PHP Fatal error: require(): Failed opening required '/home/wwwroot/object/src/api/web/../../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/object/src/api/web/index.php on line 6" while reading response header from upstream, client: 101.204.100.38, server: objectapi.ikhw.cn, request: "POST /unregistered-user/get-id HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "objectapi.ikhw.cn"
3. Reference: LNMP Add, Delete Virtual Host and Pseudo-Static Usage Tutorial Anti-Cross-Directory Settings Check the contents of .user.ini
[root@iZ2zeaj7tnbv8d3gsoy1w5Z object]# cat .user.ini
open_basedir=/home/wwwroot/object:/tmp/:/proc/
4. Edit .user.ini. The .user.ini file cannot be modified directly; to modify or delete it, you must first run: chattr -i /home/wwwroot/object/.user.ini
[root@iZ2zeaj7tnbv8d3gsoy1w5Z object]# cat .user.ini
open_basedir=/home/wwwroot/object/src:/tmp/:/proc/
5. The error persists. I finally decided to delete .user.ini. Reference: LNMP Anti-Cross-Site and Cross-Directory Security Settings, Only Supports PHP 5.3.3 and Above Edit directly in php.ini
2025/03/11 10:53:59 [error] 323149#0: *5 FastCGI sent in stderr: "PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/object/src/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/object/src/api/web/:/tmp/:/proc/) in /home/wwwroot/object/src/api/web/index.php on line 6PHP message: PHP Warning: require(/home/wwwroot/object/src/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/object/src/api/web/index.php on line 6PHP message: PHP Fatal error: require(): Failed opening required '/home/wwwroot/object/src/api/web/../../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/object/src/api/web/index.php on line 6" while reading response header from upstream, client: 101.204.100.38, server: objectapi.ikhw.cn, request: "POST /unregistered-user/get-id HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "objectapi.ikhw.cn"
2025/03/11 10:53:59 [error] 323149#0: *5 FastCGI sent in stderr: "PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/object/src/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/object/src/api/web/:/tmp/:/proc/) in /home/wwwroot/object/src/api/web/index.php on line 6PHP message: PHP Warning: require(/home/wwwroot/object/src/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/object/src/api/web/index.php on line 6PHP message: PHP Fatal error: require(): Failed opening required '/home/wwwroot/object/src/api/web/../../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/object/src/api/web/index.php on line 6" while reading response header from upstream, client: 101.204.100.38, server: objectapi.ikhw.cn, request: "POST /unregistered-user/get-id HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "objectapi.ikhw.cn"
