Linux+Apache+Mysql+PHPÓÅ»¯¼¼ÇÉ
LAMPÕâ¸ö´ÊµÄÓÉÀ´×îÔçʼÓڵ¹úÔÓÖ¾“c't Magazine”£¬Michael KunzeÔÚ1990Äê×îÏÈ°ÑÕâЩÏîÄ¿×éºÏÔÚÒ»Æð´´ÔìÁËLAMPµÄËõд×Ö¡£ÕâЩ×é¼þËäÈ»²¢²»ÊÇ¿ª¿ªÊ¼¾ÍÉè¼ÆΪһÆðʹÓõģ¬µ«ÊÇ£¬ÕâЩ¿ªÔ´Èí¼þ¶¼¿ÉÒԺܷ½±ãµÄËæʱ»ñµÃ²¢Ãâ·Ñ»ñµÃ¡£Õâ¾Íµ¼ÖÂÁËÕâЩ×é¼þ¾³£ÔÚÒ»ÆðʹÓá£ÔÚ¹ýÈ¥µÄ¼¸ÄêÀÕâЩ×é¼þµÄ¼æÈÝÐÔ²»¶ÏÍêÉÆ£¬ÔÚÒ»ÆðµÄÓ¦ÓÃÇéÐαäµÃ·Ç³£Æձ㡣ΪÁ˸ÄÉƲ»Í¬×é¼þÖ®¼äµÄÐ×÷£¬ÒѾ´´½¨ÁËijЩÀ©Õ¹¹¦ÄÜ¡£Ä¿Ç°£¬¼¸ºõÔÚËùÓеÄLinux·¢²¼°æÖж¼Ä¬ÈÏ°üº¬ÁË“LAMP stack”µÄ²úÆ·¡£ÕâЩ²úÆ·×é³ÉÁËÒ»¸öÇ¿´óµÄWebÓ¦ÓóÌÐòƽ̨
¡¡¡¡LAMP ƽ̨ÓÉËĸö×é¼þ×é³É£¬³Ê·Ö²ã½á¹¹¡£Ã¿Ò»²ã¶¼ÌṩÁËÕû¸öÈí¼þÕ»µÄÒ»¸ö¹Ø¼ü²¿·Ö£º
¡¡¡¡Linux£ºLinux ´¦ÔÚ×îµÍ²ã£¬Ìṩ²Ù×÷ϵͳ¡£ÆäËûÿ¸ö×é¼þʵ¼ÊÉÏÒ²ÔÚ Linux ÉÏÔËÐС£µ«ÊÇ£¬²¢²»Ò»¶¨¾ÖÏÞÓÚ Linux£¬ÈçÓбØÒª£¬ÆäËû×é¼þÒ²¿ÉÒÔÔÚ Microsoft® Windows®¡¢Mac OS X »ò UNIX® ÉÏÔËÐС£
¡¡¡¡Apache£º´ÎµÍ²ãÊÇ Apache£¬ËüÊÇÒ»¸ö Web ·þÎñÆ÷¡£Apache Ìṩ¿ÉÈÃÓû§»ñµÃ Web Ò³ÃæµÄ»úÖÆ¡£Apache ÊÇÒ»¿îÎȶ¨µÄ¡¢Ö§³Ö¹Ø¼üÈÎÎñµÄ·þÎñÆ÷£¬Internet Éϳ¬¹ý 65£¥ µÄÍøÕ¾¶¼Ê¹ÓÃËü×÷Ϊ Web ·þÎñÆ÷¡£PHP ×é¼þʵ¼ÊÉÏÊÇÔÚ Apache ÖУ¬¶¯Ì¬Ò³Ãæ¿ÉÒÔͨ¹ý Apache ºÍ PHP ´´½¨¡£
¡¡¡¡MySQL£ºMySQL Ìṩ LAMP ϵͳµÄÊý¾Ý´æ´¢¶Ë¡£ÓÐÁË MySQL£¬±ã¿ÉÒÔ»ñµÃÒ»¸ö·Ç³£Ç¿´óµÄ¡¢ÊʺÏÔËÐдóÐ͸´ÔÓÕ¾µãµÄÊý¾Ý¿â¡£ÔÚ Web Ó¦ÓóÌÐòÖУ¬ËùÓÐÊý¾Ý¡¢²úÆ·¡¢ÕÊ»§ºÍÆäËûÀàÐ͵ÄÐÅÏ¢¶¼´æ·ÅÔÚÕâ¸öÊý¾Ý¿âÖУ¬Í¨¹ý SQL ÓïÑÔ¿ÉÒÔºÜÈÝÒ׵زéѯÕâЩÐÅÏ¢¡£
¡¡¡¡PHP£ºPHP ÊÇÒ»Ãżòµ¥¶øÓÐЧµÄ±à³ÌÓïÑÔ£¬ËüÏñÊÇÕ³ºÏ¼Á£¬¿ÉÒÔ½« LAMP ϵͳËùÓÐÆäËûµÄ×é¼þÕ³ºÏÔÚÒ»Æð¡£Äú¿ÉÒÔʹÓà PHP ±àдÄÜ·ÃÎÊ MySQL Êý¾Ý¿âÖеÄÊý¾ÝºÍ Linux ÌṩµÄһЩÌØÐԵĶ¯Ì¬ÄÚÈÝ¡£
¡¡¡¡[¼ì²â¹¤¾ß]
¡¡¡¡ÎªÁ˵õ½ÍêÕûµÄµ÷ÊÔ½á¹û£¬½¨ÒéÄã²ÉÓà ApacheBench »òÕß httperfÖ®ÀàµÄÈí¼þ¡£Èç¹ûÄã¶Ô·Ç LAMP ¼Ü¹¹µÄ·þÎñÆ÷²âÊÔÓÐÐËȤµÄ»°£¬½¨ÒéÄã²ÉÓÃ΢ÈíµÄÃâ·ÑÈí¼þ£º Web Application Stress Tool£¨ÐèÒª NT »òÕß 2000£©¡££¨ÆäËü·þÎñÆ÷²âÊÔ¹¤¾ß£©
¼ì²â Apache £¬²ÉÓà top d 1 ÏÔʾËùÓнø³ÌµÄ CPU ºÍÄÚ´æÇé¿ö¡£ÁíÍ⣬»¹²ÉÓà apachectl status ÃüÁî
¡¡¡¡[Ó²¼þÓÅ»¯]
¡¡¡¡1¡¢Éý¼¶Ó²¼þµÄÒ»°ã¹æÔò£º¶ÔÓÚ PHP ½Å±¾¶øÑÔ£¬Ö÷ÒªµÄÆ¿¾±ÊÇ CPU £¬¶ÔÓÚ¾²Ì¬Ò³Ãæ¶øÑÔ£¬Æ¿¾±ÊÇÄÚ´æºÍÍøÂ硣һ̨ 400 Mhz µÄÆÕͨ±¼ÌÚ»úÆ÷ËùÏÂÔصľ²Ì¬Ò³Ãæ¾ÍÄÜÈà T3 רÏߣ¨45Mbps£©±¥ºÍ¡£
¡¡¡¡2¡¢²ÉÓà hdparm À´ÓÅ»¯´ÅÅÌ£¬Ò»
Ïà¹ØÎĵµ£º
Ò»¸ö¼òµ¥µÄÀý×Ó¶ÁÈ¡CSVÎļþ£º
<?php
$handle=fopen("test.csv","r");
echo "<table border=2>";
//ÅäºÏwhileÑ»·¶ÁÈ¡Îļþ
while($data=fgetcsv($handle,1024))
{
list($user,$pwd,$partment,$title)=$data;
echo "<tr>
<td>$user</td>
<td>$pwd< ......
ÍíÉÏÌØÒ⻨Á˸öʱ¼ä£¬×Ô¼º¶¯ÊÖÊÔÁËÏ¡£
ÔÚÏîÄ¿ÖÐÒ»Ö±Åöµ½Cookie¿çÓò·ÃÎʼ°SessionId¿çÓò´«µÝÎÊÌâ
·¶Àý£º
index.php
<?php
include_once('a.php');
session_start();
$_SESSION['k'] = uniqid();
setcookie("sess", session_id(), time()+3600, "/", ".ipggg.com");
echo "index.php<br />\n";
echo $ ......
´ó¼ÒºÃ£¬Çë½ÌÒ»¸öÎÊÌ⣬Âé·³ÓÐÀàËƾÑéµÄ°ï°ï棬лл¸÷λÁË!
±¾ÈËÒÔǰѧ¹ýÁ½ÄêµÄ.NET,ÓÃC#£¬ASP.NET£¬Winfrom,SQLServer×ö¹ý¼¸¸öÍøÕ¾ºÍСÐ͵ĹÜÀíϵͳ¡£
ÏÖÔÚµ½Ò»¼Òй«Ë¾£¬ÒªÇóÎÒѧPHP¡£Âé·³¸ßÊÖÖ¸µãһϣ¬P ......
php°²×°
# tar xzvf php-5.2.5.tar.gz
# cd php-5.2.5
./configure --prefix=/home/redadmin/php --with-apxs2=/home/redadmin/apache/bin/apxs --with-mysql=/home/redadmin/mysql --enable-mbstring=all --enable-track-vars
# make && make install
# cp php.ini-dist /home/redadmin/php/lib/php.ini
# c ......
1.ʹÓà ip2long() ºÍ long2ip() º¯ÊýÀ´°Ñ IP µØַת»¯³ÉÕûÐÍ´æ´¢µ½Êý¾Ý¿âÀï¡£ÕâÖÖ·½·¨°Ñ´æ´¢¿Õ¼ä½µµ½Á˽ӽüËÄ·ÖÖ®Ò»£¨char(15) µÄ 15 ¸ö×Ö½Ú¶ÔÕûÐ뵀 4 ¸ö×Ö½Ú£©£¬¼ÆËãÒ»¸öÌض¨µÄµØÖ·ÊDz»ÊÇÔÚÒ»¸öÇø¶ÎÄÚÒ³¸ü¼òµ¥ÁË£¬¶øÇÒ¼Ó¿ìÁËËÑË÷ºÍÅÅÐòµÄËٶȣ¨ËäÈ»ÓÐʱ½ö½öÊÇ¿ìÁËÒ»µã£©¡£
2.ÔÚÑéÖ¤ email µØÖ·µÄʱºòʹÓà checkdnsrr() º ......