Installing the PHP environment and configuring the WWW server method in CentOS

Source: Internet
Author: User

Profile Location:/etc/httpd/conf/httpd.conf
Page Data location:/var/www/html
Page Execution Location:/var/www/cgi-bin
Web page Related record directory:/var/log/httpd/

Installing software

Yum-y Install httpd httpd-devel httpd-manual
Yum-y Install php-5 php-bcmath php-dba php-devel php-gd php-imap php-ldap php-mbstring php-mysql php-ncurses php-odbc php -pdo php-pear php-pgsql php-snmp php-soap php-xml php-xmlrpc mod_ssl

Modify the settings file

Vi/etc/httpd/conf/httpd.conf

ServerAdmin root@localhost


Userdir Disable Modify--> #UserDir disable


#UserDir public_html modified--> Userdir www


DirectoryIndex index.html Index.html.var modified--> directoryindex index.html index.htm index.php Index.html.var


Languagepriority ZH-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-br RU SV ZH-CN
Adddefaultcharset UTF-8 modified to--> #AddDefaultCharset UTF-8 or Adddefaultcharset None

Service httpd Restart


Configuring the PHP environment


Vi/etc/php.ini

Max_execution_time = 300
Default_charset = "UTF8"
Upload_max_filesize = 180M
Post_max_size = 80M
Register_globals = On
Max_input_time = 600
Memory_limit = 160M

Vi/etc/httpd/conf.d/php.conf

DirectoryIndex index.php modified #DirectoryIndex index.php

To test whether PHP is enabled properly

echo ". Phpinfo ();?> ">/var/www/html/test.php

http://localhost/test.php

Limit a domain to read folders
vi/etc/httpd/conf/httpd.conf (format below)

<Directory/var/www/html/tool123456789>

Deny from all
Allow from IP
192.168.1.0/24
Options Indexes FollowSymLinks

</Directory>

<Directory/var/www/html/tools>

Deny from all
Allow from 163.32.x.0/24 192.168.1.0/24
Options Indexes FollowSymLinks

</Directory>

Reboot httpd

Service httpd Restart

Virtual Host
<virtualhost 163.32.x.x>

ServerAdmin user@kh.edu.tw

Documentroot/home/user

ServerName user.kh.edu.tw

Errorlog/var/log/httpd/pedagogy/user-error_log

Customlog/var/log/httpd/pedagogy/user-access_log Common

DirectoryIndex index.php index.htm index.html default.htm

</VirtualHost>

Server Change Preset codewords
Server changed to Big5 (more general 111cn.net)

vi/etc/sysconfig/i18n

Lang= "ZH_TW. Big5 "
Supported= "ZH_TW. Big5:zh_tw. Utf-8:zh_tw:zh:en_us. Utf-8:en_us:en "
Sysfont= "Latarcyrheb-sun16"

or next instruction

Export LANG=ZH_TW. Big5

Server changed to UTF-8

vi/etc/sysconfig/i18n

Lang= "ZH_TW. UTF-8 "
#LANG = "ZH_TW." Big5 "
Supported= "ZH_TW. Utf-8:zh_tw. Big5:zh_TW:zh:en_US. Utf-8:en_us:en "
Sysfont= "Latarcyrheb-sun16"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.