apacheÖÐphpÁ¬½ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µÄÎÊÌâ
ÎÊÌâÃèÊö£ºÒ»¸öÁ¬½ÓÔ¶³ÌÊý¾Ý¿âµÄPHP½Å±¾testdb.php£¬ÔÚä¯ÀÀÆ÷ÖÐÔËÐУºhttp://localhost/testdb.php£¬³öÏÖ´íÎó£ºCan't connect to MySQL server on '10.60.56.220' (13)£¬µ«ÊÇÔÚ±¾µØÓÃphpÃüÁîÐÐÔËÐУºphp testdb.php£¬È´Õý³£µØÁ¬ÉÏÁËÊý¾Ý¿â²¢¶Á³öÁËÆäÖеÄÊý¾Ý¡£
Ó¦ÓóÌÐò»·¾³£º±¾µØIP£º10.60.56.90£¬±¾µØµçÄÔÉÏ°²×°Apache 2.2.3ºÍphp 5.1.6£¬Ô¶³ÌÊý¾Ý¿â·þÎñÆ÷IP£º10.60.56.220£¬Êý¾Ý¿âÊÇmysql 5.0.45£¬±¾µØϵͳºÍÔ¶³Ìϵͳ¶¼ÊÇcentos 5.3¡£
½â¾ö·½·¨ÍêÈ«À´×ÔÓÚhttp://www.ehow.com/how_2090983_connect-remote-database-under-selinux.html£¬½â¾ö·½·¨Òì³£¼òµ¥£¬Ö»ÐèÒªÔÚ±¾µØµçÄÔÉÏÔËÐÐÒ»ÌõÃüÁ
setsebool -P httpd_can_network_connect=1
µ±È»£¬ÒªÓÐhttp·þÎñÆ÷ÉϵÄrootȨÏÞ£¬ÒòΪֻÓÐrootÓû§²ÅÄܹÜÀíselinux¡£
¹ØÓÚselinuxµÄÏêϸ֪ʶ£¬²Î¼û
°Ù¶È°Ù¿Æ£ºhttp://baike.baidu.com/view/487687.htm
WIKI£ºhttp://en.wikipedia.org/wiki/Security-Enhanced_Linux
selinux project£ºhttp://selinuxproject.org/page/Main_Page
ÔÚhttp://docs.fedoraproject.org/selinux-managing-confined-services-guide/¿ÉÒÔÏÂÔص½selinuxµÄÉèÖÃÎĵµ£¬ÆäÖÐÓÐÒ»ÕÂÊÇרÃŽ²½âapacheµÄÉèÖòÎÊýµÄ£¬³ýÁËapacheÒÔÍ⣬»¹ÓÐftp, mysql, cvs, bind, scp, nfs, sambaµÈµÈһЩ·þÎñµÄ²ÎÊý¡£
Ïà¹ØÎĵµ£º
ÕªÒª ±¾ÎĽéÉÜPHPµÄÓŵãºÍÌØÕ÷£¬½áºÏʵÀý²ûÊöÁËPHP·ÃÎÊMySQLÊý¾Ý¿âµÄ·½·¨¡£
PHP MySQL ODBC
1. ÒýÑÔ
ÔÚInternetÓ¦ÓÃÖУ¬½«·þÎñÆ÷¶Ë½Å±¾¼¼ÊõºÍ¿Í»§¶Ë½Å±¾¼¼Êõ½áºÏÆðÀ´¿ÉÒÔÖÆ×÷³ö·á¸»¶à²ÊµÄÒ³Ãæ¡£CGIºÍASPÊDZȽÏÁ÷ÐеķþÎñÆ÷¶Ë½Å±¾¼¼Êõ¡£Í¨³£CGIÔÚ¿çƽ̨µÄ¿ª·¢ÖаçÑÝ×ÅÖ÷Òª½ÇÉ«£¬¿ÉÒÔʹÓÃVB¡¢C»òP ......
Á¬½Ó£º
$conn=mysql_connect ("localhost:3306", "username", "password");
mysql_select_db("DBname");
¶Á£º
$exec="select * from stu";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
echo $rs->id." & ......
ÔÚÒÔÇ°µÄ×öµÄÀý×ÓÖÐÓöµ½¹ýÖظ´µÄ¼ÓÔصĴíÎó ¶î ÄǸöÊÇͨ¹ýinclude_once()À´½â¾ö »òÕß²»ÈÃËûÖظ´¼ÓÔØ°ÑÖظ´µÄinclude()È¥µôÒ»¸ö»ò¶à¸ö£¬×îÖÕֻʣÏÂÒ»¸öÕâÑùÎÊÌâ¾Í½â¾öÁË£¬µ«½ñÌìÓöµ½µÄÎÊÌâ¾Í¼¬ÊÖÁË ËµÊÇÕÒ²»µ½Îļþ¡£
ÊÂÇéÊÇÕâÑùµÄ £¬½ñÌìÔÚÎļþ¼ÐÀïÔÙн¨ÁËÒ»¸öÎļþ¼Ð£¬È»ºóÒÔÇ°includ ......
Ä¿Ç°Óв»ÉÙAMP£¨Apache\MySQL\PHP£©µÄ¼¯³ÉÈí¼þ£¬¿ÉÒÔÈÃÎÒÃÇÒ»´Î°²×°²¢ÉèÖúá£Õâ¶ÔÓÚ²»ÊìϤAMPµÄÓû§À´Ëµ£¬ºÃ´¦¶à¶à¡£
Ò»¡¢Ê¹ÓÃAMP¼¯³ÉÈí¼þµÄÓŵ㣺
1¡¢¿É±ÜÃâÓÉÓÚȱ·¦AMPµÄ֪ʶ£¬¶øÎÞ·¨ÕýÈ·ÉèÖû·¾³£»
2¡¢¿É¿ìËÙ°²×°²¢ÉèÖúÃAMP»·¾³£¬ÈÃÎÒÃÇÖ±½Ó¿ªÊ¼ÕæÕý¸ÐÐËȤµÄÈí¼þ£¬Èçxoops£»
3¡¢¿É·½±ãµÄ´î½¨²âÊÔ»·¾³£¬¶ÔÓÚ² ......