Welcome! Log In Create A New Profile

Advanced

How to set root absolute include path in a php-fpm + nginx?

Posted by todor.petrov 
How to set root absolute include path in a php-fpm + nginx?
July 08, 2023 04:29PM
I have the following files structure:

var ####################################
└── www ##############################
#####└── html ##########################
########## ├── include ##################
########## │######└── DB_tools.php ######
########## └── index.php ################

I want to put require_once('/include/DB_tools.php'); in index.php file so that it includes the DB_tools.php. Currently it gives me the following error:

Fatal error: Uncaught Error: Failed opening required '/include/DB_tools.php' (include_path='/var/www/html/') in /var/www/html/index.php:3 Stack trace: #0 {main} thrown in /var/www/html/index.php on line 3

default.conf:

server {
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

My question in Stackoverflow - https://stackoverflow.com/questions/76638623/how-to-configure-root-include-path-for-dockerized-php-with-nginx
Re: How to set root absolute include path in a php-fpm + nginx?
July 13, 2023 08:05AM
Find my solution here:
https://stackoverflow.com/questions/76638623/how-to-configure-root-include-path-for-dockerized-php-with-nginx
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 278
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready