apache and php common tips and problems
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
Ïà¹ØÎĵµ£º
//´´½¨Îļþ¼Ð
function createdir($dir){
$edir = explode('/',$dir);
for($i=0;$i<count($edir);$i++)
{
$edirm = $edir[0];
for($ii=1;$ii<=$i;$ii++)
{
$edirm = $edirm.'/'.$edir[$ii];
}
if(file_exists($edirm) && is_dir($edirm))
{}
else
{
@mkdir ($edir ......
$_POST ±äÁ¿ÓÃÓÚÊÕ¼¯À´×Ô method="post" µÄ±íµ¥ÖеÄÖµ¡£
$_POST ±äÁ¿
$_POST ±äÁ¿ÊÇÒ»¸öÊý×飬ÄÚÈÝÊÇÓÉ HTTP POST ·½·¨·¢Ë͵ıäÁ¿Ãû³ÆºÍÖµ¡£
$_POST ±äÁ¿ÓÃÓÚÊÕ¼¯À´×Ô method="post" µÄ±íµ¥ÖеÄÖµ¡£´Ó´øÓÐ POST ·½·¨µÄ±íµ¥·¢Ë͵ÄÐÅÏ¢£¬¶ÔÈκÎÈ˶¼ÊDz»¿É¼ûµÄ£¨²»»áÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸£©£¬²¢ÇÒ¶Ô·¢ËÍÐÅÏ¢µÄÁ¿Ò²Ã»ÓÐÏÞÖ ......
PHP session ±äÁ¿ÓÃÓÚ´æ´¢ÓйØÓû§»á»°µÄÐÅÏ¢£¬»ò¸ü¸ÄÓû§»á»°µÄÉèÖá£Session ±äÁ¿±£´æµÄÐÅÏ¢Êǵ¥Ò»Óû§µÄ£¬²¢Çҿɹ©Ó¦ÓóÌÐòÖеÄËùÓÐÒ³ÃæʹÓá£
PHP Session ±äÁ¿
µ±ÄúÔËÐÐÒ»¸öÓ¦ÓóÌÐòʱ£¬Äú»á´ò¿ªËü£¬×öЩ¸ü¸Ä£¬È»ºó¹Ø±ÕËü¡£ÕâºÜÏñÒ»´Î»á»°¡£¼ÆËã»úÇå³þÄãÊÇË¡£ËüÖªµÀÄãºÎʱÆô¶¯Ó¦ÓóÌÐò£¬²¢ÔÚºÎʱÖÕÖ¹¡£µ«ÊÇÔÚÒòÌØ ......
×î½ü°ïʵÑéÊÒÍêÉÆÒ»¸öCMSϵͳ£¬ÏÖÔÚÒѾ½øÈëβÉù£¬½è´Ë»ú»á¼òÒª¼Ç¼һÏÂʵÏÖµÄϸ½Ú£¬ÒÔ±¸ËùÐè¡£
±¾ÏµÍ³ÊǸö´¿´âµÄÔÚÏßÄÚÈݹÜÀíϵͳ£¬×îÖ÷ÒªµÄ²Ù×÷¾ÍÊÇÏòÊý¾Ý¿âÖÐÌí¼Ó¡¢Ð޸ĺÍɾ³ýÊý¾Ý£¬Ó¦¸Ã˵ʵÏÖÆðÀ´ºÜ¼òµ¥£¬²»¹ýÕýÊÇÒòΪ¼òµ¥£¬Ê¹µÃÔÓÐϵͳÏԵúÜÄÑά»¤£¬¼òµ¥ÀàËƵIJÙ×÷ÓÐ20¶à¸ö²»Í¬µÄÒ³Ã棬ÿ¸öÒ³Ãæ ......