Welcome! Log In Create A New Profile

Advanced

Re: Unable to see a php page

Francis Daly
March 20, 2020 05:32PM
On Mon, Mar 16, 2020 at 09:40:40PM +0330, Mahmood Naderan wrote:

Hi there,

> OK with this configuration:
>
> location ~ \.php$ {
> root /home/ubuntu/htdocs/public_html;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
> include fastcgi_params;
> }

> when I open "localhost/index.php", I can see the php page, however, in the
> logs/error.log I see these
>
> 2020/03/16 21:34:22 [error] 5821#0: *2 FastCGI sent in stderr: "PHP
> message: PHP Warning: session_start() [<a
> href='function.session-start'>function.session-start</a>]:
> open(/tmp/http_sessions/sess_dd0e14b5b3f5aebcb53015b6bebc3bfa, O_RDWR)
> failed: No such file or directory (2) in
> /home/ubuntu/htdocs/public_html/index.php on line 26

That's a PHP thing -- perhaps make the directories, or perhaps configure
your PHP to use a different directory. PHP documentation should indicate
how.

> Also I see somethings like
>
> 2020/03/16 21:34:22 [error] 5821#0: *2 open()
> "/home/ubuntu/htdocs/js/dragdrop.js" failed (2: No such file or directory),
> client: 127.0.0.1, server: localhost, request: "GET /js/dragdrop.js
> HTTP/1.1", host: "localhost", referrer: "http://localhost/index.php"
>
>
> I don't know why it is using "/home/ubuntu/htdocs/js/dragdrop.js"?
> According to the setting, it should look for it at
> "/home/ubuntu/htdocs/public_html/js/dragdrop.js" where the file actually
> exists.

The config you showed only uses /home/ubuntu/htdocs/public_html as the
document root for requests that end in .php.

The request /js/dragdrop.js is not handled in this location. The
configuration in, or inherited into, the location that handles
that request is the one that matters. And that, presumably, has
/home/ubuntu/htdocs as the configured document root.

Possibly setting "root /home/ubuntu/htdocs/public_html;" at server{}
level will cause things to work for you.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Unable to see a php page

Mahmood Naderan March 15, 2020 08:30AM

Re: Unable to see a php page

Francis Daly March 15, 2020 09:24AM

Re: Unable to see a php page

Mahmood Naderan March 15, 2020 09:52AM

Re: Unable to see a php page

Francis Daly March 15, 2020 10:02AM

Re: Unable to see a php page

Ian Hobson March 16, 2020 11:14AM

Re: Unable to see a php page

Mahmood Naderan March 16, 2020 02:12PM

Re: Unable to see a php page

Francis Daly March 20, 2020 05:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready