아주 쉽게 제공된다.
예시
<?
// mail send
$stringId = "code0gm@naver.com";
$header = "From:공명<code0gm@gmail.com>\r\n";
$header .= "Content-type:text/html\r\n";
$subject = "welcome to paperbus !";
$mailContent = "Congratulation <br>";
$mailContent .= "click this link and active your email! <br>";
$mailContent .= "<a href='http://test.nachal.com/login/active/?key=123123123'><font color=red>this link</font></a>";
$email = mail($stringId,$subject,$mailContent,$header);
if(!email) echo "mail send failed";
echo "완료";
?>
사용하기위해선 was의 mail관련 설정이 멀쩡한지 살펴본다
SMTP 가 어느서버인지 포트는 정상인지.
개발서버는 윈도우서버를 사용하기때문에 SMTP 서비스를 열어서 로컬에서 사용했다.
'php'에 해당되는 글 3건
- 2010.06.07 메일보내기
- 2010.05.26 CentOS 에서 apache + php 설치하기 1
- 2010.05.20 php 설정
CentOS 에서 apache + php 설치하기
Dev/Apache / 2010. 5. 26. 18:33
아파치부터 받죠
apache.org 에서 잘 받아 와요
적당한데다 복사합니다.
압축을 풉니다.
환경설정을 하겠어요
나가 사용할 옵션이에요. 막따라하지말구 모르는사람은 설치경로 , -so옵션만 붙이세요.
./configure \
--prefix=/usr/local/apache2 \
--enable-modules=ssl \
--with-ssl=/usr/local/openssl \
--enable-mods-shared=all \
--enable-so \
--enable-rewrite \
--enable-proxy \
--enable-proxy-ajp \
--enable-proxy-balancer \
--enable-proxy-http \
--enable-proxy-connect \
--enable-ssl
아 ssl 까먹었네 있다가 하겠어요
php를 설치합니다.
환경설정파일이에여.
옵션은 하나하나 잘 읽어보세요. 없으문 당연히 에러가 납니다.
진짜로 사용할것만 추가하는게 바른 자세에요.
./configure
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql-5.0.44 \
--enable-magic-quotes \
--enable-mod-charset \
--enable-mbstring \
--enable-sigchild \
--enable-safe-mode \
--enable-bcmath \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--enable-ftp \
--with-snmp \
--with-zlib \
--with-zlib-dir \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gd \
--enable-gd-native-ttf \
--with-ttf \
--with-gettext \
--enable-exif \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-curl \
--with-ncurses \
--enable-sqlite-utf8 \
--with-regex=php \
--with-bz2 \
--with-mcrypt \
--with-iconv=/usr/local/lib \
--enable-modules=so
--with-openssl
php 컴파일할때 에러가 나네요
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
좋은분들이 많아서 원인이 파악됬네요. 관련된 imap관련 모듈 버젼이 따라오지못해서 생기는 오류라고 합니다.
yum을 사용해서 필요한 라이브러리를 설치합니다.
yum -y install libc-client
yum -y install libc-client-devel
뭐야 에러가 게속나네
다 필요한 라이브러리가 없어서 그런겁니다.
로그를 잘 살펴서 필요한 라이브러리들을 추가해줍니다.
애초에 이런 에러가 나오는것 자체가 configure 옵션을 이해하지 못했다는거죠? 챙피해요.
아무튼 설치가 끝났습니다.
이제 아파치의 환경설정파일을 바꾸게됩니다.
어디다 설치했죠?
--prefix=/usr/local/apache2
/conf/httpd.conf 파일이 있겠죠 ?
사실 옵션에 다줘서 설치했기 때문에 필요한놈들은 다 들어와 있습니다.
sso module 는 주석 안풀어줘두 댑니다. built in 방식으루 설치가됬기때문에(아파트인가?)
따로 추가해버리면 에러가 납니다.
일단 sso모듈 적용안한상테에서 아파치와 php의 연결상태를 확인합니다.
물론 두말할것두없이 잘 됩니다.
끝
* 빵꾸똥꾸내용
CentOS5.0 에서 설치했습니다.
httpd-2.2.15 + php-5.3.2 버젼에서 원인을 알수없는 오류 ( phplib.so 파일이 정상적으로 생성되지 않더군요. 내부라이브러리 개념을 좀더 잘알았으면 알아서 해결할수 있을거같은데 .. 핑곗거리가 좀 많아서 다른버젼 설치함.)
httpd-2.2.15 + php5.2-201005260630 로 성공했습니다. ( 같은옵션 하에서 그냥 됩니다.)
'Dev > Apache' 카테고리의 다른 글
apache RewriteEngine (0) | 2010.06.10 |
---|---|
apache 인덱싱 기능 (1) | 2010.06.07 |
apache + openssl 적용 (0) | 2010.05.28 |
아파치(apache) 가상호스팅 (0) | 2010.05.25 |
Apache + Tomcat 연동 (0) | 2010.05.25 |
1. apache/conf/httpd.conf 수정
<IfModule mime_module> 내부에 추가
AddType application/x-httpd-php .php .html .htm .php3 .php4 .inc
AddType application/x-httpd-php-source .phps
모듈추가
LoadModule php4_module e:/project/php/php5apache.dll
* apache2.2와 php5.2는 안맞는다. 별도로 작업할꺼 아니면 피하기.
2. php.ini 수정
register_globals = Off (변수 전달방법에대한 설정)
default_charset = "euckr" (캐릭터셋 설정)
extension=php_mysql.dll (사용할 db 드라이버를 풀어준다.)
extension_dir = "E:/project/php53/ext" (기타 라이브러리)
3. 파일이동
php.ini -> windows
php5ts.dll -> windows/system32