CentOS에 PHP 설치하기

By | 4월 17, 2014

- 출처 : http://dev.antoinesolutions.com/php -

* 나의 환경: CentOS 5.9 

* 붉은 색 글씨는 원문과 실제 환경이 달라서 수정한 것을 나타냄

 

 

Version

This documentation was written for PHP 5.1.6 but may be usefull with other versions.

 

How to install PHP

  1. Run the yum install command
    yum install php

 

How to configure PHP

  1. Increase PHP script memory limit
    In the /etc/php.ini file replace memory_limit = 16M withmemory_limit = 128M
  2. Increase PHP script max execution time
    In the /etc/php.ini file replace max_execution_time = 30 with max_execution_time = 120
  3. Increase PHP script max upload size
    In the /etc/php.ini file replace upload_max_filesize = 2Mwith upload_max_filesize = 50M
    In the /etc/php.ini file replace post_max_size = 8M withpost_max_size = 50M
  4. Create the /usr/share/phpinfo folder
    mkdir /usr/share/phpinfo
  5. Create the /usr/share/phpinfo/index.php file with the following text:
    <?php
      phpinfo();
    ?>
  6. Change permissions on the index.php file
    chmod 0755 /usr/share/phpinfo/index.php
  7. Create the /etc/httpd/conf.d/phpinfo.conf file with the following text:
    # phpinfo - PHP utility function for displaying php configuration

    # Allows only localhost by default

    Alias /phpinfo /usr/share/phpinfo
    <Directory /usr/share/phpinfo/>
       order deny,allow
       deny from all
       #테스트시 403에러 때문에 수정함.
       #allow from 127.0.0.1
       allow from all
    </Directory>

  8. Restart Apache Server
    service httpd restart

 

 

Test

Visit localhost/phpinfo in your web browser. You should see the infamous phpinfo output. If the address bar changes to somthing other than http://서버주소/phpinfo/, than somthing went wrong while following the instructions and your browser has interpreted this as a search. Try following the instruction again. If it still doesn't work, send me an email via my contact page and let me know somthing isn't working right. If it did work, you have successfully installed PHP.

 

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments