éçºç°å¢æ´åæé
ã¤ãã§ãªã®ã§æ¸ãã¦ããããPerlã§ã®éçºã®ããã«ãCPANã·ã§ã«ãã»ããã¢ãããããã¨ã¨ãApacheãã«ã¹ã¿ãã¤ãºãããã¨ãã¡ã¤ã³ã ã
0. ã³ã³ãã¤ã«ç°å¢ã®æ´å
Xcodeãå ¥ããã¨gccã¯ãã¡ããmakeã¨ããã¤ã³ã¹ãã¼ã«ããããã®ã§ãæ´åã¨ãã£ã¦ããããã¨ã¯ãªãã
1. å¿ è¦ãªããã°ã©ã ã®ã¤ã³ã¹ãã¼ã«
- lynx (http://lynx.browser.org/) : http://dev.osxgnu.org/software/pkgdetail.html?project_id=%20226ã«Mac Portsã®pkgã¤ã³ã¹ãã¼ã©ããã
- wget (http://www.gnu.org/software/wget/)
- ncftp (http://www.ncftp.com/) : ncftpgetãå ¥ã
- gpg (http://www.gnupg.org/) : http://macgpg.sourceforge.net/ã«Mac Portsã®pkgã¤ã³ã¹ãã¼ã©ããã
- expat (http://expat.sourceforge.net/) : XML::Parserã§å¿ è¦
ã½ã¼ã¹ã³ã¼ãããmakeãããã®ã¯ãåºæ¬çã«ã¯é©å½ãªã¢ã¼ã«ã¤ããæ¢ããè½ã¨ãã¦å±éãTerminalã§ãã®ãã£ã¬ã¯ããªã«å ¥ãã
./configure make sudo make install
ã¨ãããã°è¯ãã
lynx, wget, ncftpgetãªããã¯ã¢ã¼ã«ã¤ããã¦ã³ãã¼ãæã«ä½¿ããããªã®ã ããå¿ ãããå ¨é¨å ¥ã£ã¦ããªãã¦ãå¹³æ°ã ã£ããããããã ãgpgãç¡ãã¦åé¡ãªãã£ããexpatã¯XML::Parserã§ä½¿ãã®ã§ãXMLãæ±ããªãå ¥ãã¦ããã¦æã¯ãªãããCPANã»ããã¢ããèªä½ã«ã¯ä¸è¦ã
å¿ è¦ãªãMySQLã¨ãããããã®ãã¤ã³ã¹ãã¼ã«ããããã®ã¿ã¤ãã³ã°ã§ãªãã¦ããããã©ã
2. CPANã·ã§ã«ã®ã»ããã¢ãã
管çè 権éã§ã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ãããã®ã§ãsudoã使ãã
sudo cpan
å¾ã¯è³ªåã«çãã¦ããã®ã¿ãéä¸å¤é¨ããã°ã©ã ã®ãã¹ãèãããã®ã§ã1.ã§å ¥ããããã°ã©ã ã®ãã¹ãçãããCPANã·ã§ã«ãè¦ã¤ããã°ããã©ã«ãã§ãã¹ãå ¥ãã®ã§ããªã¿ã¼ã³ãæ¼ãã ããè¦ã¤ãã¦ããããªãå ´åã¯ãå¤å/usr/local/bin/xxxã¨ãã«å ¥ã£ã¦ããã¯ããªã®ã§ãæ¢ãã¦ã¿ããå¾ã¯é©å½ã«ã
ããããåæã«ãã£ã¦ããã®ã§ããã°ããæ¾ã£ã¦ããããã¾ã«ä½ãèããããçãã¦ãããã
3. å¿ è¦ãªã¢ã¸ã¥ã¼ã«ã®ã¤ã³ã¹ãã¼ã«
ä¾åé¢ä¿çã«å ã«å ¥ã£ã¦ããã¹ããã®ã¯å ã«å ¥ããããã®ã«ãã£ã¦ã¯åæã«å ¥ãã¦ããã¡ãã£ãããããããã ããä¸å¿ãXML::Parserãªããã¯çµæ§æåã®ã»ãã«ãªããããªæ°ãããããªããã¦ã¼ã¶ã¼æ¨©éã§å ¥ããããªããé©å½ãªå ´æã«@INCãéããprefixã§ãããæå®ããã°è¯ããããªæ°ãããã
- MIME::Parser
- MIME::Lite
- HTML::Tagset
- HTML::Parser
- HTML::Template
- Template
- LWP
- IO::Socket::SSL
- Crypt::SSLeay
- XML::Parser
- XML::LibXML
- XML::LibXSLT
- XML::RSS
- XML::RSS::LibXML
- FCGI
- Date::Simple
- DateTime::TimeZone
- DateTime
- DBI
- DBD::SQLite
- DBD::mysql
- Class::DBI
- Class::DBI::SQLite
- Class::DBI::Loader::mysql
- Class::DBI::mysql
- Net::Jabber
- SOAP::Lite
- XML::Atom
- XML::Feed
ãã¼ããããããããªãâ¦ããã®ãã¡èªååãããã
ã¢ã¸ã¥ã¼ã«ã®ååãåãã£ã¦ãããªããCPANã·ã§ã«å ãã
install LWP
ã¨ãã§ãå ´åã«ãã£ã¦ã¯éä¸ã§ä½ãèãããã¨ããããããè¯ãããã«ãã£ã¦ãããã
4. ãµã¼ãã調ãã
ããã¯å ã§ãå¾ã§ãè¯ãããWebã·ã¹ãã ã®ãã¹ãç¨ã«ãµã¼ãã調ãã¦ãããMac OS Xã®å ´åãã·ã¹ãã ç°å¢è¨å®ã®ãå ±æãã§ããã¼ã½ãã«Webå ±æããç«ã¡ä¸ããã¨ApacheãåããCGIãããã«åä½å¯è½ã ããCGIãç½®ããã£ã¬ã¯ããªãå¶éããã¦ãããããã®ã§ã使ããããããã«ã«ã¹ã¿ãã¤ãºããã
ãªããããããã®ä½æ¥ã§ã¯ãé©åº¦ãªã¿ã¤ãã³ã°ã§ã³ã³ãã£ã°ãã¡ã¤ã«ã®ãã§ãã¯ããã¦ããã¨è¯ããï¼å ¨é¨ãã£ã¦ããã ã¨ã©ãã§ééã£ããåããã«ããã®ã§ãï¼
apachectl configtest
ã«ã¹ã¿ãã¤ãºã§ã©ããããã¯å¥½ã¿ã ããããã§ã¯CGIçãªã©ãå®è¡å¯è½ã«ãã¦ãããã¥ã¡ã³ãã«ã¼ããèªåã®Sitesã«ãããï¼ä½æ¥ã§ã¯ããã¯ã¢ãããå¿ããã«ãï¼
CGIã¨SSIãå®è¡å¯è½ã«ããã«ã¯ãApacheã®èªåã®ãã£ã¬ã¯ããªã®è¨å®ãæ¸ãæãã¦ããã
sudo emacs /etc/httpd/users/altair.conf
<Directory "/Users/altair/Sites/"> AddType text/html shtml AddHandler server-persed shtml AddHandler cgi-script cgi Options Indexes MultiViews ExecCGI Includes AllowOverride All Order allow,deny Allow from all <IfModule mod_dir.c> DirectoryIndex index.cgi index.php index.shtml index.html </IfModule> </Directory>
ããã¥ã¡ã³ãã«ã¼ãã®æ¸ãæãã¯ãhttpd.confã®365è¡ç®ä»è¿ã«ãããã³ã¡ã³ãã¢ã¦ãã§æ¸ãæããã
# DocumentRoot "/Library/WebServer/Documents" DocumentRoot "/Users/altair/Sites"
mod_perlãmod_phpãæå¹ã«ããã
239è¡ç®ä»è¿ã®perl_moduleãphp4_moduleã®ã³ã¡ã³ãã¢ã¦ããå¤ããï¼ctrl + sã§æ¤ç´¢ããã®ãæ©ããï¼
LoadModule perl_module libexec/httpd/libperl.so LoadModule php4_module libexec/httpd/libphp4.so
283è¡ç®ä»è¿ã®mod_perlãmod_phpã®ã³ã¡ã³ãã¢ã¦ããå¤ãã
AddModule mod_perl.c AddModule mod_php4.c
é©å½ãªå ´æã§ãphpã®Typeãè¨å®ãããã¦ã¼ã¶ã¼ã®ã³ã³ãã£ã°ãã¡ã¤ã«ã§ãè¯ãããéããã¤ãã§ã¨ãããã¨ã§httpd.confã«æ¸ãã¦ã¿ãã855è¡ç®ä»è¿ã«AddTypeã並ãã§ããã¨ãããããã®ã§ããã®è¾ºãã«æ¸ãã¨ééããªãããã
ã¡ãªã¿ã«ãã®ä¸¦ã³ã®#AddHandler cgi-script .cgiã¨ãã®ã³ã¡ã³ãã¢ã¦ããããããã©ã¤ãã¼ããªãµã¼ããªã®ã§ã©ã£ã¡ã«æ¸ããã¯å¥½ã¿ã ã¨æãããã¦ã¼ã¶ã¼ãã¡ã¤ã«å´ã«æ¸ãã¦ããã»ããã¹ãã¼ããªæããããã
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
ãã®ã¾ã¾ã ã¨phpã®ãã¼ãµã
<? ... ?>
ã«åå¿ãã¦ãã¾ãï¼XML宣è¨ã§ã使ãã®ã§ãã¨ã©ã¼ã«ãªãæãããï¼ã®ã§ãçç¥è¨æ³ã使ç¨ä¸å¯ã¨ãããphp.ini.defaultãç¨æããã¦ããã®ã§ããããã³ãã¼ãphp.iniã¨ããä¸ã§ããã®ãã¡ã¤ã«ãç·¨éããã
sudo cp /etc/php.ini.default /etc/php.ini sudo emacs /etc/php.ini
Language Options以ä¸ã«short_open_tagã®è¨å®ãããã
short_open_tag = Off
è¨å®ãçµãããã³ã³ãã£ã°ãã¡ã¤ã«ã®ãã§ãã¯ã§ãåé¡ããªããã°ãApacheããªã¹ã¿ã¼ãããã
sudo apachectl restart