PHP¸¦ Apache Dynamic Shared Object (DSO)·Î ÄÄÆÄÀÏ Çϱâ ====================================================== °æ°í»çÇ×: ÀϺΠÇ÷§Æû¿¡¼­ DSO ¹öÁ¯ÀÇ Apache/PHP°¡ ºÒ¾ÈÇÏ´Ù´Â º¸°í°¡ ÀÖ½À´Ï´Ù. ¸¸¾à ÀÌ·± Áõ»óÀÌ ³ªÅ¸³­´Ù¸é PHP¸¦ INSTALL ÆÄÀÏ¿¡¼­ ¼³¸íÇÑ ´ë·Î static ÇüÅ·ΠÄÄÆÄÀÏÇØ º¸±â ¹Ù¶õ´Ù. ¶ÇÇÑ ¸¸¾à ¿©·¯ºÐÀÌ Apache 1.3.4 ¹öÁ¯À» »ç¿ëÇÏ°í ÀÖÁö ¾Ê´Ù¸é Æ÷±âÇÏ°í static ÇüÅ·ΠÄÄÆÄÀÏÇϱ⠹ٶõ´Ù. ±×·¸Áö ¾Ê´Ù¸é Apache¸¦ ¾÷±×·¹À̵åÇϵµ·Ï ÇÑ´Ù. ÀÌ ÆÄÀÏÀÇ ³»¿ë: ¹æ½Ä 1: APXS ¹æ½Ä METHOD 2: --with-shared-apache ¹æ½Ä ¹®Á¦ ÇØ°á ¹æ½Ä 1: APXS ¹æ½Ä ----------------- ÀÌ ¹æ½ÄÀº PHP¸¦ ÀÌ¹Ì ÄÄÆÄÀÏ/½ÇÇàµÇ°í ÀÖ´Â Apache ¼­¹ö¿¡ Ãß°¡ÇÏ´Â °¡Àå ±ú²ýÇÑ ¹æ¹ýÀÌ´Ù. ¿©·¯ºÐÀÇ ¼­¹ö´Â mod_so¸¦ Æ÷ÇÔÇϵµ·Ï ¸¸µé¾îÁ® ÀÖ¾î¾ß ÇÑ´Ù.("httpd -l"·Î È®ÀÎÇÒ ¼ö ÀÖ´Ù.) ¶ÇÇÑ,'apxs' Perl ½ºÅ©¸³Æ®°¡ ¼³Ä¡µÇ¾î ÀÖ°í, ¿øÇÏ´Â ¼­¹ö setupÀ» ÇÒ ¼ö ÀÖµµ·Ï ¼³Á¤µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù. ¾Æ·¡ÀÇ Step 1 ´ë·Î ÇÏ¸é ¿øÇÏ´Â ¼­¹ö setupÀ» ÇÒ ¼ö ÀÖ´Ù. Step 1: ¿ì¼± Apache¸¦ ¸¸µç´Ù. À̶§ ¹Ýµå½Ã mod_so¸¦ enable½ÃÄÑ¾ß ÇÑ´Ù. ´ÙÀ½°ú °°ÀÌ ÇÏ¸é µÈ´Ù. : cd apache-1.3.x ./configure --prefix=/some/path --enable-shared=max make make install Apache ¼³Á¤ ¿É¼Ç¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº Apache ¹èÆ÷º»¿¡ ÀÖ´Â README.configure ÆÄÀÏÀ» ÂüÁ¶ÇÏÀÚ. ÀÌÁ¦ /some/path/bin/apxs°¡ ¾î´À µð·ºÅ丮¿¡ Àִ°¡¸¦ È®ÀÎÇØ µÐ´Ù. step 2·Î ³Ñ¾î°¡¸é 'apxs' ÇÁ·Î±×·¥ÀÌ ¾î´À À§Ä¡¿¡ Àִ°¡¸¦ ¾Ë¾Æ¾ß ÇÑ´Ù. Step 2: PHP¸¦ ¸¸µç´Ù. cd php-3.0.x ./configure --with-apxs=/some/path/bin/apxs \ --with-config-file-path=/some/path make make install ¹°·Ð ¿©·¯ºÐÀÌ ¿øÇÏ´Â ¸ðµç ¿É¼ÇÀ» ÁÙ ¼ö ÀÖ´Ù. ÀÚ¼¼ÇÑ ¿É¼ÇÀÇ ¸®½ºÆ®¸¦ ¿øÇϸé ./configure --help ¸í·ÉÀ» ³»·Áº»´Ù. Step 3: /some/path/conf/httpd.conf ÆÄÀÏÀ» ÆíÁýÇÏ¿© ´ÙÀ½°ú °°Àº ¶óÀÎÀ» Æ÷ÇÔ Çϵµ·Ï ÇÑ´Ù. : AddType application/x-httpd-php3 .php3 ¹°·Ð ¿øÇÏ´Â ´Ù¸¥ ¿É¼Çµéµµ httpd.conf¿¡ ¼³Á¤Çϵµ·Ï ÇÑ´Ù. ¶ÇÇÑ php3.ini-dist ÆÄÀϵµ /some/path/php3.ini·Î º¹»çÇØ µÎ°í ¿øÇÏ´Â ¼³Á¤À» Çϵµ·Ï ÇÑ´Ù. Step 4: ¼­¹ö¸¦ Start/Restart : /some/path/bin/apachectl start or /some/path/bin/apachectl restart or /some/path/bin/apachectl graceful ¹æ½Ä 2: --with-shared-apache ¹æ½Ä --------------------------------- ÀÌ ¹æ½ÄÀº À§ÀÇ ¹æ½Ä¿¡ ¹èÇØ ±×·¸°Ô ±ú²ýÇÏÁö ¾Ê´Ù. ±×·¯³ª ¿©·¯ºÐÀÌ ¿©·¯°¡Áö ÀÌÀ¯·Î apxs ¹æ½ÄÀ» »ç¿ëÇÏÁö ¸øÇÒ °æ¿ì À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ´Ù. apxs ¹æ½ÄÀÌ Apache setup¿¡¼­ 'make install'ÇÏ¿© ³ª¿Â °á°ú ÆÄÀϸ¸ÀÌ ÇÊ¿äÇѵ¥ ¹ÝÇؼ­ ÀÌ ¹æ½ÄÀº PHP¸¦ ÄÄÆÄÀÏÇϱâ À§ÇØ ¿ÏÀüÇÑ Apache source tree Àüü°¡ ÇÊ¿äÇÏ´Ù. Step 1: ApacheÀÇ ./configure ÇÁ·Î±×·¥À» ÃÖ¼ÒÇÑ Çѹø ½ÇÇàÇÑ´Ù. ÀüüÀûÀÎ ÄÄÆÄÀÏÀ» ÇÒ ÇÊ¿ä´Â ¾ø°í, Apache ./configure ÇÁ·Î±×·¥ÀÌ ¸¸µé¾î ³»´Â ÀϺΠÇì´õ ÆÄÀÏÀÌ ÇÊ¿äÇϱ⠶§¹®ÀÌ´Ù. ÀÌ ¶§ Apache ./configure·Î ³Ñ°ÜÁÖ´Â ¿É¼ÇµéÀº ¾Æ¹« Àǹ̰¡ ¾ø´Ù. Step 2: ÀÌÁ¦ PHP¸¦ ¼³Á¤ÇÏ°í, Apache ¼Ò½º Æ®¸®°¡ ¾îµð¿¡ Àִ°¡¸¦ °¡¸£ÃÄ ÁØ´Ù. ´ÙÀ½°ú °°Àº ¹æ½ÄÀ¸·Î ÇÏ¸é µÈ´Ù. ./configure --with-shared-apache=/some/path/to/src/of/apache-1.3.X \ --with-config-file-path=/some/path make make install ¸¸¾à ´Ù¸¥ PHP ¿É¼ÇÀ» ÁöÁ¤ÇØ ÁÖ·Á¸é, ¸¶Âù°¡Áö·Î configure ¶óÀο¡ Ãß°¡ÇØ ÁÖ¸é µÈ´Ù. ./configure --help ¸í·ÂÀ¸·Î ÀÚ¼¼ÇÑ ¿É¼ÇÀ» È®ÀÎÇÏÀÚ. Step 3: Apache ¸¸µé±â Apache src tree µð·ºÅ丮·Î À̵¿ÇÏ¿© ´ÙÀ½°ú °°ÀÌ ½ÇÇàÇÑ´Ù. ./configure --prefix=/some/path \ --activate-module=src/modules/php3/libphp3.a \ --enable-shared=php3 make make install ÀÌ¹Ì ÀÌÀü¿¡ ¸¸µç Apache°¡ ¼³Ä¡µÇ¾î ÀÖ´Ù¸é, ÀÌ °æ¿ì¿¡µµ 'make install'À» ÇÏ¸é µÈ´Ù. ÇÏÁö¸¸ --prefix µð·ºÅ丮¸¦ ´Ù¸¥ Àӽà µð·ºÅ丮·Î ¼³Á¤ÇÏ¿© ¸¸µé¾îÁø ÆÄÀϵéÀ» »ìÆì º¸´Â °ÍÀ» ÃßõÇÑ´Ù. ƯÈ÷ PHP ¸ðµâÀ» loadÇÏ´Â httpd.confÀÇ ³»¿ëÀ» Àß »ìÆ캸ÀÚ. ±×¿Ü¿¡ ÇØ¾ß ÇÒ ÀÏÀº php3¿¡ ´ëÇÑ AddType ¶óÀÎÀÇ ÄÚ¸àÆ®(ù¹ø° Ä­ÀÇ #)¸¦ Áö¿ì´Â °ÍÀÌ´Ù. ¿¹¸¦ µé¾î ´ÙÀ½°ú °°ÀÌ ¸¸µç´Ù. : AddType application/x-httpd-php3 .php3 ¹®Á¦ ÇØ°á --------- If you are compiling PHP with support for a whole whack of modules and want to load the whole mess dynamically, you may find yourself getting the following error: ld: fatal: too many symbols require `small' PIC references: have 2077, maximum 2048 -- recompile some modules -K PIC. This should not happen on any Intel platforms, but I ran across it on a Sun Sparc box running Solaris. The message which comes from the linker is assuming I am using the native Sun C compiler I guess and suggests I use "-K PIC". This may be correct if you are using that compiler. For gcc the way to fix it is to edit the PHP Makefile and near the top find the line that says: CFLAGS_SHLIB = -fpic and change the "-fpic" to "-fPIC". I would imagine that this would slow things down a bit though and you might want to consider doing a static build instead.