CentOS MySQL php Curl

Source: Internet
Author: User
Tags soap mysql in mysql version iptables

Open 80 ports

#/sbin/iptables-i input-p TCP--dport 80-j accept #/sbin/iptables-i input-p tcp--dport 22-j ACCEPT   Then save:  #/etc/rc.d/init.d/iptables save   again to see if it already has:  [[email protected] ~]#/etc/init.d/ Iptables status table:filter chain INPUT (Policy ACCEPT)  num  target     prot opt source &N Bsp             destination         1    accept     UDP  -- 0.0.0.0/0            0.0.0.0/0           UDP DP T:80 2    accept     TCP  -- 0.0.0.0/0            0.0.0. 0/0           TCP dpt:80 3    rh-firewall-1-input  all  -- 0.0.0.0 /0            0.0.0.0/0            chain FORWARD (Policy ACCEPT)  num  target &nbsp   Prot opt source               destination         1 &NB Sp  rh-firewall-1-input  all  -- 0.0.0.0/0            0.0.0.0/0 two. Restart your computer. The  1.centos operating system firewall has already opened the 80 and 22 port  2 by default. This should also be done without restarting the computer: #/etc/init.d/iptables Restart the firewall off, shutting down its services:  3. View firewall information: #/etc/init.d/iptables status 4. Shutdown Firewall Service: #/etc/init.d/iptables stop  three. Permanently shut down the firewall   we can also permanently shut down the firewall , but I do not recommend it. Permanently shut down the firewall can do this: #chkconfig –level iptables off can also be directly modified/etc/sysconfig/iptables add a-a rh-firewall-1-input- M state--state new-m tcp-p TCP--dport 80-j accept  =========== install MySQL

[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.

============== Installing 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.

================= Installing 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

================= 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.

================= 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.

================= problems

Yum installs a MySQL version of 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

Installing Curl

Yum Install Curl Php-curl

CentOS MySQL php Curl

Related Article

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.