Refresh

PHP 스쿨호스팅 서버 직접 세팅하기

제가 사용하는 서비스는 “가상서버호스팅” 입니다.
운영체제는 “Cent OS 6.x” 를 사용하구요. 신청할 때 apm 설치는 하지 않았습니다.
매뉴얼 설치해서 이것저것 해보기 위함 입니다만 일단 여기에 설치하는 내용은 yum 을 이용한 패키지 설치입니다.
(역시 귀차니즘이.. ㅋㅋ)

[Apache2.2]
보통 설치되어 있습니다.
– 위치 conf : /etc/httpd/conf , doc : /var/www/html , command : /usr/sbin
하지만 직접 설치를 하신다면 아래와 같이 설치하시면 됩니다.
– (1) apr : ./configure –prefix=/usr/local/apr-1.5.0
– (2) apr-util : ./configure –prefix=/usr/local/apr-util-1.5.4 –with-apr=/usr/local/apr-1.5.0
– (3) pcre : ./configure -> make -> make test -> make install
– (4) httpd : ./configure –prefix=/usr/local/apache2 –enable-modules=most –enable-mods-shared=all –enable-so –enable-rewrite –enable-ssl –enable-vhost-alias –with-apr=/usr/local/apr-1.5.0 –with-apr-util=/usr/local/apr-util-1.5.4
– (etc) 위 처리 중 오류가 zlib 로 발생 (업로드 후 ./configure -> make -> make test -> make install)
– (cp libz.so* /usr/local/lib/ 하고 다시 httpd 시도 중 ssl toolkit 오류 발생 일단 해당 항목 제외)

자 웹서버를 설치했으니 이제 PHP 를 설치해 볼까요.

[php 5.3.3 버전 설치]
– yum install php
– yum install php-gd
– yum install php-ldap
– yum install php-mbstring
– yum install php-mysql
– yum install php-xml
– yum install php-xmlrpc
– /etc/php.ini : short_open_tag = on (short 태그를 사용하시려면 여기서 수정하시면 됩니다.)
[apache 쪽 설정 부분]
– /etc/httpd/conf.d/php.conf 에 아래와 같은 내용들을 확인해주세요.

AddHandler php5-script .php .html .htm
AddType text/html .php .html .htm
AddType application/x-httpd-php .htm .html
DirectoryIndex index.php index.html index.htm

 

다음은 MySQL 입니다. 기본적으로 yum 저장소에 있는 버전은 5.0 이나 5.1 인데요. 전 5.5 로 올려서 설치했습니다.

[mysql  5.5 버전 설치]

– yum install libmysqlclient15 –enablerepo=webtatic
– 위처럼 하면 mysql55w 가 webtatic updates 로 추가됨
– 그런데 mysql55w 로 설치할 경우 mysql-libs 를 필요로 하는 모듈이 있을 경우 에러가 발생할 수 있다고 함. 하지만 그건 닥치면 해결 방안이 있지 않을까?
– yum install yum-plugin-replace
– yum replace mysql-libs –replace-with mysql55w-libs

– 위에서 처리하다가 경고 발생

WARNING: Unable to resolve all providers: [‘config(mysql-libs)’, ‘libmysqlclient.so.16()(64bit)’, ‘libmysqlclient.so.16(libmysqlclient_16)(64bit)’, ‘libmysqlclient_r.so.16()(64bit)’, ‘libmysqlclient_r.so.16(libmysqlclient_16)(64bit)’]

– 크게 상관없는 경고인 것 같음. 일단 그냥 진행 (stackoverflow : It can sometimes signify something wrong, but if you confirm it, you’ll see the packages being installed and uninstalled, so that will be more familiar to you to see whether things like postfix is unintentially being uninstalled –  AndyApr 17 ’14 at 6:28)

– yum install mysql55w mysql55w-server –enablerepo=webtatic
– data 위치 -> /var/lib/mysql (mysql 설정에서 변경 가능합니다.)

위처럼 하면 5.5 버전으로 설치가 됩니다.
뽀나쓰로 데이터베이스와 계정 설정 관련 쿼리를 확인합니다.

1. create database db default character set utf8;
2. create user ‘userid’@’%’ identified by ‘passwd’;
3. grant all privileges on db.* to ‘userid’@’%’;
4. flush privileges;

하면 데이터 베이스와 계정이 생성됩니다. db 에는 사용할 db명, userid 는 사용할 id 이구요. passwd 는 비번~

이렇게 설치를 하고 나면 방화벽 정책에서 포트를 확인해야 합니다.

 –  vi(vim) /etc/sysconfig/iptables
– -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
– -A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
(80 웹서버, 3306 MySQL)

– service iptables stop
– service iptables start

이렇게 확인하면 됩니다.

나중엔 개발에 필요한 내용을 추가해보도록 하지요~

댓글 남기기

Back to Top