现在的位置: 首页 > 综合 > 正文

apache and php common tips and problems

2013年03月12日 ⁄ 综合 ⁄ 共 1903字 ⁄ 字号 评论关闭

When I deploy php application on apache, some problem come out, and solved. Here's the tips and problems solved.

0.How could I deploy an apache server armed with php, mysql, perl, and phpMyAdmin on the fly?
You need a package bundled with all these tools,  xampp shall meet you needs, you can download it here
(windows/mac/linux/Solaris supported):

http://sourceforge.net/projects/xampp/files/

1. I meet the php page error:

strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

You can
explicitly set it in any of the following ways:

a.The date.timezone setting in php.ini
b.At runtime with date_default_timezone_set()
c. Setting the TZ variable in Apache's environment (in
httpd.conf, .htaccess, or a few other ways)

solve a: uncomment the date.timezone line, and set the timezone to your desired,
such as 'Europe/Berlin' or 'Asia/Shanghai'

   [Date]
   ; Defines the default timezone used by the date functions
   date.timezone = Asia/Shanghai

2. apache/logs/error.log shows "Bad file descriptor: don't know how to spawn child process" like :
[Mon Jan 25 16:59:59 2010] [error] [client 127.0.0.1] D:/XXXServer/trend/coretech/abc.html is not executable; ensure interpreted scripts have "#!" first line
[Mon Jan 25 16:59:59 2010] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: D:/XXXServer/trend/coretech/abc.html
[Mon Jan 25 18:17:49 2010] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: D:/mywebapp/img/left-content-header.css, referer: http://127.0.0.1/mywebapp/navigation.php

solution: some version of Apache/2.2.14 (Win32) doesn't process read only files properly, 
you can solve it by "AddHandler  default-handler .jpg .gif .js .txt .bat .html .css" to your Directory section:

<Directory />
    AddHandler default-handler .jpg .gif .js .txt .bat .html .css
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

抱歉!评论已关闭.