2

I'm using Lighttpd / PHP-CGI on a Windows XP machine.

I was using the normal CGI interface which is very stable, but I tried FastCGI and I love the speed boost. However, even under light load, the PHP-CGI daemon will just crash after an hour or so.

I've taken care to eliminate all warnings and notices that get pushed to the error log. My server has about 1500MB excess RAM when it crashes, so that's not the issue.

Just by visiting the site and holding down F5 for about 30 seconds will crash PHP-CGI with a blank error log. Does anyone know what could be causing this? Is there any additional error reporting that I could use, or any gotchya's I'm unaware of?

php.ini:

;NOTE: THE ONLY LINE THAT'S NOT DEFAULT TO php.ini-production IS "error_log = F:/php_errors.log"

[PHP]
engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
error_log = F:/php_errors.log
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]

lighttpd.conf:

server.modules              = (
                                "mod_access",
                                "mod_accesslog",
                               "mod_fastcgi",
                               "mod_redirect",
                               "mod_rewrite",
                                "mod_status",
                               )
include "variables.conf"
include "mimetype.conf"
server.document-root        = server_root + "/htdocs"
server.upload-dirs          = ( temp_dir )
index-file.names            = ( "index.php", "index.pl", "index.cgi", "index.cml",
                                "index.html", "index.htm", "default.htm" )
server.event-handler        = "libev"
url.access-deny             = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".cgi" )
dir-listing.activate        = "enable"
status.status-url           = "/server-status"
status.config-url           = "/server-config"


fastcgi.server = ( ".php" =>( "localhost" =>("host" => "127.0.0.1","port" => 521 )))

#Probably irrelevant

$HTTP["url"] !~ "^/index.php?.*$|^/$|^/style.css$|^/random.php$|^/latest.php$|^/images/[^\.]*\.[^\.]*$|^/deviant/[^\.]*\.[^\.]*$|^/ie-css3.htc$|^/markdown.js$" {
     url.access-deny = ("")
}
url.rewrite-once = (
    "^/post/(.*)$"  => "/index.php?page=readpost.php&postid=$1"
    ,"^/comment/(.*)$" => "/index.php?page=comment.php&target=$1"
    ,"^/random$" => "/random.php"
    ,"^/latest$" => "/latest.php"
    ,"^/posted$" => "/index.php?page=posted.php"
    ,"^/style$" => "/index.php?page=style.css"
    ,"^/index.php.*$" => "/"
    ,"^/register$" => "/index.php?page=register.php"
    ,"^/registered$" => "/index.php?page=registered.php"
    ,"^/login$" => "/index.php?page=login.php"
    ,"^/loggedin$" => "/index.php?page=loggedin.php"
    ,"^/logout$" => "/index.php?page=logout.php"
    ,"^/blogupdate$" => "/index.php?page=blogupdate.php"
    ,"^/blogged$" => "/index.php?page=blogupdated.php"
    ,"^/deletepost/(.*)$" => "/index.php?page=deletepost.php&post=$1"
    ,"^/deleteblog/(.*)$" => "/index.php?page=deleteblog.php&post=$1"


)

$SERVER["socket"] == ":443" {
   ssl.engine                  = "enable"
   ssl.ca-file = "f:/www/ca-certs.crt"
   ssl.pemfile                 = "f:/www/ssl.crt"

}
server.max-fds = 2048

Edit: I just tried holding down F5 with the only script running being <?PHP die("alive"); ?> and PHP is still crashing.

mgorven
  • 30,615
  • 7
  • 79
  • 122
Kaslai
  • 121
  • 3
  • Could you provide us your lighttpd & php-fastcgi conf? – j0k Feb 02 '13 at 13:10
  • Sure, but it's basically all default. I'll pare out all the comments that come with the default files and upload them. –  Feb 02 '13 at 13:11
  • http://pastebin.com/2wuPuiFY php.ini and http://pastebin.com/CbGAUwCH lighttpd.conf. In lighttpd.conf, it includes a default mimetypes and variables config, except variables has my root directory listed in it. –  Feb 02 '13 at 13:18
  • Have you tried to add `cgi.fix_pathinfo = 1` in your php.ini? – j0k Feb 02 '13 at 13:57
  • I tried that and I'm still crashing – Kaslai Feb 02 '13 at 22:36
  • Is there anything in Lighttpd's error log? Is Lighttpd spawning the PHP process or are you starting it externally? – mgorven Feb 05 '13 at 01:05
  • I'm starting the PHP daemon externally. The error log just says that the interface is overloaded. – Kaslai Feb 05 '13 at 01:59

1 Answers1

0

PHP crashing? impossible! :D

Check phps log, attach a debugger to php to see what happens, update your php, or use a real operating system :)

I don't think this has anything to do with the webserver or the webserver configuration.

Maybe you configured php to exit after a certain amount of requests? (If you configure children >= 1, php should have a master process that respawns the workers)

Stefan
  • 859
  • 1
  • 7
  • 18
  • Thanks for the reply, but I just installed Gentoo on the box a month or two ago and everything works swimmingly now :) – Kaslai May 01 '13 at 21:44