LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-28-2012, 01:34 AM   #1
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Rep: Reputation: Disabled
.php not working on lighttpd


i installed lighttpd and configure document root /var/www/html. as i install fastfgi+lighttpd+php
when i use index.html then it opens okay . But when i try to open a index.php I get a 404 -not found...
 
Old 03-28-2012, 06:47 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

A 404 (not found) error means that the index.php is not under the docroot of your webserver.
Make sure that the docroot is /var/www/html and you have index.php under that directory.

Regards
 
Old 03-28-2012, 07:13 AM   #3
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
lighttpd

Hi

index.php is on the correct path as when i use index.html on same path it works properly.. & when i use same php files on Apache it works well, but not on lighttpd ....


Quote:
Originally Posted by Kuldeep1333 View Post
i installed lighttpd and configure document root /var/www/html. as i install fastfgi+lighttpd+php
when i use index.html then it opens okay . But when i try to open a index.php I get a 404 -not found...
 
Old 03-28-2012, 07:15 AM   #4
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
Hi bathory,

index.php is on the correct path as when i use index.html on same path it works properly.. & when i use same php files on Apache it works well, but not on lighttpd ....

Quote:
Originally Posted by bathory View Post
Hi,

A 404 (not found) error means that the index.php is not under the docroot of your webserver.
Make sure that the docroot is /var/www/html and you have index.php under that directory.

Regards
 
Old 03-28-2012, 08:10 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
index.php is on the correct path as when i use index.html on same path it works properly.. & when i use same php files on Apache it works well, but not on lighttpd ....
Are you sure? What is the "server.document-root" in lighttpd.conf?
You can enable debugging to see where lighttpd searches for the index.php. For this you can use:
Code:
debug.log-request-handling  = "enable"
debug.log-file-not-found       = "enable"
 
Old 03-29-2012, 01:37 AM   #6
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
Hi bathory

As you suggest i done that, but it still not working , now when i checked error_log it gives following logs:


2012-03-28 19:43:58: (response.c.539) -- logical -> physical
2012-03-28 19:43:58: (response.c.540) Doc-Root : /var/www/html
2012-03-28 19:43:58: (response.c.541) Rel-Path : /
2012-03-28 19:43:58: (response.c.542) Path : /var/www/html/
2012-03-28 19:43:58: (response.c.559) -- handling physical path
2012-03-28 19:43:58: (response.c.560) Path : /var/www/html/
2012-03-28 19:43:58: (response.c.567) -- file found
2012-03-28 19:43:58: (response.c.568) Path : /var/www/html/
2012-03-28 19:43:58: (response.c.717) -- handling subrequest
2012-03-28 19:43:58: (response.c.718) Path : /var/www/html/
2012-03-28 19:43:58: (mod_indexfile.c.150) -- handling the request as Indexfile
2012-03-28 19:43:58: (mod_indexfile.c.151) URI : /
2012-03-28 19:43:58: (mod_access.c.135) -- mod_access_uri_handler called
2012-03-29 11:34:29: (response.c.298) -- splitting Request-URI
2012-03-29 11:34:29: (response.c.299) Request-URI : /
2012-03-29 11:34:29: (response.c.300) URI-scheme : http
2012-03-29 11:34:29: (response.c.301) URI-authority: 192.168.1.71
2012-03-29 11:34:29: (response.c.302) URI-path : /
2012-03-29 11:34:29: (response.c.303) URI-query :
2012-03-29 11:34:29: (response.c.347) -- sanatising URI
2012-03-29 11:34:29: (response.c.348) URI-path : /
2012-03-29 11:34:29: (mod_access.c.135) -- mod_access_uri_handler called
2012-03-29 11:34:29: (response.c.468) -- before doc_root
2012-03-29 11:34:29: (response.c.469) Doc-Root : /var/www/html
2012-03-29 11:34:29: (response.c.470) Rel-Path : /
2012-03-29 11:34:29: (response.c.471) Path :



Quote:
Originally Posted by bathory View Post
Are you sure? What is the "server.document-root" in lighttpd.conf?
You can enable debugging to see where lighttpd searches for the index.php. For this you can use:
Code:
debug.log-request-handling  = "enable"
debug.log-file-not-found       = "enable"
 
Old 03-29-2012, 02:34 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Hmm, the crappy lighttpd logging. It doesn't mention what is the file it tries to retrieve.
Anyway, what happens if you use: http://x.x.x.x/index.php ?
Also check lighttpd.conf and make sure you have index.php into the index-file.names:
Code:
index-file.names = (
  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)
Regards
 
Old 03-29-2012, 02:43 AM   #8
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
Dear bathory

it's already defiend: check below

index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )


& there's only one file (index.php : test page i remove all other ) on document root. & i also checked it by using domainname/index.php on browser, it also not work...
& i also insatall lighttpd one another server it not works there & gives same error.

can you suggest me any alternation from so i can use .php pages on. or install lighttpd using any other way.... currently we are using Apache on our server's & due to some performance problem we want to install lighttpd

Quote:
Originally Posted by bathory View Post
Hi,

Hmm, the crappy lighttpd logging. It doesn't mention what is the file it tries to retrieve.
Anyway, what happens if you use: http://x.x.x.x/index.php ?
Also check lighttpd.conf and make sure you have index.php into the index-file.names:
Code:
index-file.names = (
  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)
Regards
 
Old 03-29-2012, 02:46 AM   #9
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
following lighttpd and php rpm exist on my system::

[root@lighthttp lighttpd]# rpm -qa | grep lighttpd
lighttpd-fastcgi-1.4.26-1.el5.rf
lighttpd-1.4.26-1.el5.rf
[root@lighthttp lighttpd]# rpm -qa | grep php
php-ldap-5.2.10-1.el5.centos
php-cli-5.2.10-1.el5.centos
php-5.2.10-1.el5.centos
php-mbstring-5.2.10-1.el5.centos
php-common-5.2.10-1.el5.centos
php-imap-5.2.10-1.el5.centos
php-devel-5.2.10-1.el5.centos
php-xml-5.2.10-1.el5.centos
php-pear-1.8.1-2.el5.centos
php-pdo-5.2.10-1.el5.centos
php-mysql-5.2.10-1.el5.centos
php-gd-5.2.10-1.el5.centos


Quote:
Originally Posted by bathory View Post
Hi,

Hmm, the crappy lighttpd logging. It doesn't mention what is the file it tries to retrieve.
Anyway, what happens if you use: http://x.x.x.x/index.php ?
Also check lighttpd.conf and make sure you have index.php into the index-file.names:
Code:
index-file.names = (
  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)
Regards
 
Old 03-29-2012, 04:02 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Does not make sense.
Do you have also the following:
Code:
static-file.exclude-extensions =  ( ".php", ".pl", ".fcgi", ".scgi" )
I see you're using rhel/centos, so check if this is due to SELinux.

Quote:
can you suggest me any alternation from so i can use .php pages on. or install lighttpd using any other way.... currently we are using Apache on our server's & due to some performance problem we want to install lighttpd
Unfortunately you have to use fast-cgi to serve php pages on lighttpd. Regarding performance, you can use nginx, but it also uses fast-cgi to run php.
 
Old 03-29-2012, 05:06 AM   #11
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
Smile Hi bathory,

As i checked fast-cgi also exist on my system. i'm sending the configuration file attach with this message, Kindly check

Thanks for your support,



Quote:
Originally Posted by bathory View Post
Does not make sense.
Do you have also the following:
Code:
static-file.exclude-extensions =  ( ".php", ".pl", ".fcgi", ".scgi" )
I see you're using rhel/centos, so check if this is due to SELinux.


Unfortunately you have to use fast-cgi to serve php pages on lighttpd. Regarding performance, you can use nginx, but it also uses fast-cgi to run php.
Attached Files
File Type: txt lighttpd_conf_file.txt (11.7 KB, 741 views)
 
Old 03-29-2012, 05:53 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You have commented out the whole fastcgi settings. Of course that shouldn't give a 404 error, but who knows?
Uncomment them and restart lighttpd to see what you get.
 
Old 03-30-2012, 07:39 AM   #13
Kuldeep1333
LQ Newbie
 
Registered: Mar 2012
Location: Noida
Posts: 28

Original Poster
Rep: Reputation: Disabled
Dear bathory

Thanks for your support, it's working now.......


Quote:
Originally Posted by bathory View Post
You have commented out the whole fastcgi settings. Of course that shouldn't give a 404 error, but who knows?
Uncomment them and restart lighttpd to see what you get.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP exec() issue with chrooted lighttpd JSmaniak Linux - Server 10 04-03-2010 01:48 AM
Lighttpd, PHP, SQLITE, and a Forum ammorais Linux - Software 7 12-16-2009 10:35 PM
Slackware 13 64-bit + php 5.3.0 + lighttpd 1.4.23 -> fastcgi problems lordbone Linux - Software 2 10-14-2009 11:00 AM
seem to have hung php on lighttpd pellicle Linux - Server 1 08-13-2009 12:42 PM
apache proxypass, or lighttpd php belorion Linux - General 2 07-15-2005 10:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration