nginx php mysql
°²×° Nginx
* Ò»ÌõÃüÁî¸ã¶¨£º
USE=fastcgi emerge nginx
* н¨Óû§ºÍ×飺
groupadd www
useradd www -g www
Nginx °²×°ºÃºóĬÈÏ»áÌí¼Ó nginx ×éºÍ nginx Óû§£¬²»¹ýÎÒ±¾Éí»¹ÊÇÏ°¹ßн¨¸ö www ×éºÍ www Óû§À´×ö HTTP ·þÎñÓû§¡£Èô½ñºó HTTP ·þÎñÆ÷¸ü»»Îª apache »òÊÇ lighttpd ʱ£¬Óû§ÃûºÍÓû§×é¿ÉÒÔ²»±ä¡£
°²×° MySQL
ÔÚ×° PHP Ç°±ØÐëÏÈ×° MySQL£¬ÒòΪ PHP ÀïµÄ MySQL ²Ù×÷º¯ÊýÐèÒª MySQL Í·ÎļþºÍ¿âµÄÖ§³Ö¡£
mysql_install_db --basedir=/usr --datadir=/work/db/3306/data --user=mysql
mkdir -p /work/db/3306/data
mysql_install_db
* ÐÞ¸ÄÅäÖÃÎļþ£º
vim /etc/mysql/my.cnf
½« datadir ÐÞ¸ÄΪ£º
datadir = /work/db/3306/data
* Æô¶¯ MySQL£º
/etc/init.d/mysql start
* ÐÞ¸Ä root ÃÜÂ룺
mysqladmin -uroot password hily
* ²âÊÔÊý¾Ý¿â£º
mysql -uroot -p
ÏÔʾ£º
gentoo setup # mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.84-log Gentoo Linux mysql-5.0.84-r1
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
²âÊԳɹ¦£¡
°²×° PHP
ÒÔ fastcgi ·½Ê½À´ÔËÐÐ PHP£¬ÐèÒª°²×° PHP-FPM¡£
Ä¿Ç°×îºóÒ»¸öÐèÒªÒÔ patch ÐÎʽ°²×° PHP-FPM µÄ PHP °æ±¾ÊÇ 5.3.0£¬PHP 5.3.2 °æ±¾Öн«¿ÉÄÜÖ±½Ó¼¯³É PHP-FPM¡£
ÕâÀïÎÒ¾ÍʹÓà PHP 5.3.0 À´°²×°¡£
ÒòΪ Gentoo ÖÐĿ¼»¹Ã»Óм¯³É PHP-FPM µÄ Portage£¬ËùÒÔÏÂÃæÖ±½Óͨ¹ýÔ´Âë±àÒëÐÎʽ½øÐа²×°¡£
* ÏÂÔØ PHP 5.3.0£º
wget http://cn.php.net/distributions/php-5.3.0.tar.bz2
* ÏÂÔØ PHP-FPM ²¹¶¡£º
wget http://php-fpm.org/downloads/php-5.3.0-fpm-0.5.12.diff.gz
* ½âѹ PHP ²¢´ò FPM ²¹¶¡£º
tar jxf php-5.3.0.tar.bz2
gzip -cd php-5.3.0-fpm-0.5.12.diff.gz | patch -d php-5.3.0 -p1
* °²×° PHP ÐèÒªµÄ¿â£¨¸ù¾Ý×ÔÉíÐèÒª£©£º
emerge libpng
emerge jpeg
emerge freetype
USE="png jpeg truetype" emerge gd
»òÕßÖ±½Ó£º
USE="png jpeg truetype" emerge gd
* ÅäÖò¢±àÒë PHP£¨¸ù¾Ý×ÔÉíÐèÒª£©£º
cd php-5.3.0
./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-mysql=/usr –with-mysqli=/usr/bin/mysql_config –enable-fpm &n
Ïà¹ØÎĵµ£º
»¨Á˼¸¸öСʱµÄʱ¼äÑо¿Ò»Ï£¬·¢ÏÖ»¹ÊDZȽϺÃÓõģ¡
smarty¿ÉÒԺܺõؽ«Âß¼Óë±íÏÖ·ÖÀ룬ºǫ́³ÌÐòÔ±ºÍwebÇ°¶Ë¹¤³Ìʦ¸÷¸É¸÷µÄÊ£¬²»ÏñÒÔÇ°£¬php´úÂëºÍhtml´úÂëÔÓºÏÔÚÒ»Æ𣬺ǫ́³ÌÐòÔ±ºÍÇ°¶ËÇ°ÐòÔ±Ò»Æð·¢ì£¬ÒòΪËûÃǵļ¼ÄÜÒªÇó¸ü¸ßÁË£¬¶¼±ØÐëÒª¶®¶Ô·½µÄÓïÑÔ£¬ºÇºÇ£¡
ÍøÉϽéÉܵÄÅäÖÃÌ«¶ßàÂÁË£¬Ò²ÐíÊÇÀÏ°æ±¾µÄÔµ¹ÊµÄ£¬ÒòΪÎÒ ......
±±¾©´óѧÈí¼þÓë΢µç×ÓѧԺ“¶à²ã´Î¡¢¶à·½Ïò¡¢¶àÁìÓò¡¢Ä£¿é»¯” µÄ¿ª·Åʽ¿Î³ÌÌåϵ£¬¾Êµ¼ù¼ìÑéÖ¤Ã÷£¬·Ç³£ÊÊÓÃÓÚÅàÑø“¶à²ã´Î¡¢ÊµÓÃÐÍ¡¢¸´ºÏ½»²æÐÍ¡¢¹ú¼Ê»¯”µÄÈí¼þÓë΢µç×ÓÈ˲š£ÎªÂú×ãÉç»áºÍÆóÒµ¶ÔÈ˲ŵÄÐèÇ󣬶ԸßÖÊÁ¿µÄ¼ÌÐø½ÌÓýÏîÄ¿µÄÐèÇ󣬱±¾©´óѧÈí¼þÓë΢µç×ÓѧԺ³ÉÁ¢Á˼ÌÐø½ÌÓýÖÐÐÄ£¬ÃæÏòÉ ......
ͨ³£ÎÒÃÇдһ¸öÀàÈçÏ£º
a.php
class A
{
public function __construct()
{
echo "hello world!";
}
}
page.php
require("a.php");
$a = new A();
ÎÒÃÇÊÇͨ¹ýÊÖ¹¤ÒýÓÃij¸öÀàµÄÎļþÀ´ÊµÏÖº¯Êý»òÕßÀàµÄ¼ÓÔØ
µ«Êǵ±ÏµÍ³±È½ÏÅÓ´ó£¬ÒÔ¼°ÕâЩÀàµÄÎļþºÜ¶àµÄʱºò£¬ÕâÖÖ·½Ê½¾ÍÏԵ÷dz ......
Ò»£º½á¹¹ºÍµ÷ÓÃ(ʵÀý»¯)£º
class className{} £¬µ÷Óãº$obj = new className();µ±ÀàÓй¹Ô캯Êýʱ£¬»¹Ó¦´«Èë²ÎÊý¡£Èç$obj = new className($v,$v2...);
¶þ£º¹¹Ô캯ÊýºÍÎö¹¹º¯Êý£º
1¡¢¹¹Ô캯ÊýÓÃÓÚ³õʼ»¯£ºÊ¹ÓÃ__construct()£¬¿É´ø²ÎÊý¡£
2¡¢µ«Îö¹¹º¯Êý²»ÄÜ´ø²ÎÊý£¨ÓÃÓÚÔÚÏúÈ¥Ò»¸öÀà֮ǰִÐÐһЩ²Ù×÷»ò¹¦ÄÜ£©¡£Îö¹¹º¯ÊýÓà ......