Php_linux_centos6.4_ installation mysql_apache_php

Source: Internet
Author: User
Tags install php soap mysql version iptables fully qualified domain name

Original: Php_linux_centos6.4_ installation mysql_apache_php

Original:

http://blog.csdn.net/xiaoliouc/article/details/17639503

To some of the error, I have made a supplement

Recent projects made in PHP to the project deployment, the server for the centos6.4 system, in order to quickly deploy, the use of Yum installation deployment

Most of the Content reference blog http://blog.sina.com.cn/s/blog_c02ed6590101d2sl.html

First, install MySQL

Start with the MySQL installation. Open HyperTerminal and enter:

[email protected] ~]# yum install MySQL Mysql-server

The installation is complete so that MySQL can start automatically with the system:

[Email protected] ~]# chkconfig--levels 235 mysqld on
[[email protected] ~]#/etc/init.d/mysqld start

To set the password for the MySQL data root account:

[Email protected] ~]# mysql_secure_installation

Press ENTER directly when prompted as follows:

Enter Current password for root

Appear as follows to enter again:

Set root Password? [y/n]

The following prompts you to enter the password you need to set, enter after entering the confirmation:

New Password:

Then there will be four confirmations, namely:

Remove anonymous users? [y/n]
Disallow Root login remotely? [y/n]
Remove test database and access to it? [y/n]
Reload privilege tables now? [y/n]

You can enter directly.

Second, install Apache components

Since CentOS has encapsulated Apache, run the installation directly:

[email protected] ~]# Yum install httpd

Also configure the system to allow Apache to boot with the system:

[Email protected] ~]# chkconfig--levels 235 httpd on

After configuration, start Apache:

[[email protected] ~]#/etc/init.d/httpd start

Now that you have access to your server, you can see the test page "Apache 2 test page powered by CentOS", without any surprises. Note that if the other machine accesses the service and cannot display this page, it can be accessed directly on this server, which is normally forbidden by the CentOS-brought firewall. You only need to enter the firewall, the "WWW" corresponding to the "80" port to open.

Note: The default root directory for Apache in CentOS is/var/www/html, configuration file/etc/httpd/conf/httpd.conf. Other configurations are stored in the/etc/httpd/conf.d/directory.

"If an error occurs starting httpd:httpd:Could not reliably determine the server ' s fully qualified domain name, using"

1) Enter Apache installation directory: (depending on individual installation) [[email protected] ~]# cd/etc/httpd/conf2) Edit httpd.conf file, search "  #ServerName", add ServerName localhost:[email protected] conf]# Lsextra  httpd.conf  Magic  mime.types  original[[email protected] conf]# VI httpd.conf#servername www.example.com :ServerName localhost:3~]#/etc/init.d/httpd Restart

LocalHost can be written as an extranet, otherwise it can only be accessed internally

"Test internal access to curl localhost"

If the firewall interception, the external network access, such as input vip.test.com [front servername configuration is servernamevip.test.com:80"

CentOS Firewall Open 80 Port online Search a lot of did not solve the problem, the following is the correct method: #  -Jaccept# -J ACCEPT then Save: #/etc/rc.d/init.d/iptables Save

Port View Method:

[Email protected] ~]#/etc/init.d/iptables status

]

Third, install PHP

Enter the following command to install PHP:

[[email protected] ~]# Yum install PHP

The Apache service needs to be restarted:

[Email protected] ~]#/etc/init.d/httpd restart

Iv. Testing PHP Related information

This step can actually be omitted, but in order to test whether the installation is successful, you can create a new PHP page to test and create a new one using the VIM editor:

[Email protected] ~]# vi/var/www/html/info.php

Press "I" key to edit, enter:

<?php
Phpinfo ();
?>

After editing, press "ESC" key to exit edit mode, then enter:

: Wq

Then enter, save and exit.

At this point you can access your site address, such as "http://192.168.1.2/info.php", to see if you can see the relevant PHP information.

V. Linking the PHP module with the MySQL module

You also need to associate PHP with MySQL in order to work properly. Search module:

[email protected] ~]# Yum search php

To install the relevant modules:

[email protected] ~]# Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

The Apache module needs to be restarted to take effect:

[Email protected] ~]#/etc/init.d/httpd restart

Refresh the "info.php" page you just created, and pull down to find the relevant MySQL module to see if the relevant information is detected.

Issue 1: In order for other computers to access, the simple method is to turn off fire before, the use of the command/etc/rc.d/init.d/iptables stop is not recommended

The logical approach is to use the iptables rule, as follows

Closing all INPUT FORWARD OUTPUT is only available on certain ports.
Here is the command implementation:

Iptables-p INPUT DROP
Iptables-p FORWARD DROP
Iptables-p OUTPUT DROP

Then use the command iptables-l-N to see if it's set up, good-looking to all DROP
Such a setup, we are only temporary, restart the server or will restore the original not set the state
and save with service Iptables save
See information firewall rules Firewall rule is actually saved in/etc/sysconfig/iptables
can open File View Vi/etc/sysconfig/iptables

Reference Blog HTTP://HI.BAIDU.COM/BEIJIQIEYS/ITEM/5EE9BBCF94F0A712B67A24CF

Issue 2:yum The MySQL version installed is 5.1.7, the default Latin character, which needs to be modified to utf-8. VI/ETC/MY.CNF file, add Default-character-set=utf8, as follows

[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Default-character-set=utf8
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
[MySQL]
Default-character-set=utf8

Issue 3: The project uses the MB_SUBSTR function and the SOAP protocol, PHP is not installed by default, yum install php-mbstring and yum install Php-soap, restart APACHE,/ETC/INIT.D/HTTPD Restart

Issue 4: Default Apache points to the/var/www/html directory, if I want to point to/var/www/html/project, modify httpd.conf

vi/etc/httpd/conf/httpd.conf command, find/var/www/html change to/var/www/html/project, restart Apache service,/etc/init.d/httpd restart

Issue 5: Project must have read and write permissions

Using the chmod-r * * command

Modify Publishing Path Error

stopping httpd: [OK]
Starting Httpd:Warning:DocumentRoot [/home/chenpenghui/web/web-6s] does not exist

Of course, it is also possible to prohibit SELinux.
/usr/sbin/setenforce 0 Close SELINUX immediately
/usr/sbin/setenforce 1 Enable SELINUX now

Php_linux_centos6.4_ installation mysql_apache_php

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.