Server environment setup under MAC System
(1) Apache (WEB) server
The Web server is also known as the WWW (Worldwide Web) server, and the main function is to provide online information browsing services. A Web server is a program that can provide documentation to the requesting browser
(1) The server is a passive program: The server responds only when a request is made by a browser running on the Internet on another computer
(2) The most commonly used Web server is the Apache and Microsoft Internet Information Server IIS
(3) A Web server is a computer with a separate IP address on the Internet
(4) A Web server is a program that resides on some type of computer on the Internet
IP Address: 127.0.0.1
is the loopback address, refers to the local machine, commonly used to test the use
No matter what program, once send data using loopback address, the protocol software returns immediately without any network transmission
Common test commands: ping 127.0.0.1
Domain name: localhost
In the computer network, localhost (local host) is a standard host name for the Loop network interface, and the corresponding IP address is 127.0.0.1
1.0 Apache Server Boot
sudo apachectl–k start
Modifying system-level operations requires the sudo command to execute
1.1 Restart
sudo apachectl–k restart
1.2 Server started successfully:
1.3 Locate the Apache document directory
cd/etc/apache2/ the directory where the configuration file is located
 
sudo vim httpd.conf configuration file
 
1.4 site Resource Directory/documentroot
Normal user does not have write permission in this directory
/library/ Webserver/documents
 
remarks:
in Mac systems, many system-level services are configured by:
(1) Modify the configuration file
(2) Restart the service
Test Server run: (Put some resources under the site Resources directory!)
(2) PHP support
PHP (php:hypertext preprocessor abbreviation, Chinese name: "Hypertext Preprocessor") is a common open source scripting language. Low entry threshold, easy to learn, widely used, mainly for web development
One of the most popular lightweight web scripting development languages
(1) PHP unique syntax mixed with C, Java, Perl and PHP self-innovative syntax
(2) PHP can execute dynamic pages more quickly than CGI or perl-dynamic pages, compared to other programming languages:
(3) PHP is executed by embedding the program in an HTML document, which is much more efficient than CGI, which generates HTML markup entirely.
(4) PHP has a very powerful function, all CGI functions PHP can be implemented
(5) PHP supports almost all popular databases and operating systems
(6) The most important is that PHP can be used in C, C + + program extension
2.1 PHP Support Open
cd/etc/apache2
sudo vim httpd.conf
search/php< /span>
save exit
cd/etc
sudo CP php.ini.default php.ini
finally restarts Apache server
&NBSP;
test:
(1) The new info.php is saved in the site Directory
(2) The contents of info.php are as follows:
<body>
<?php phpinfo ();?>
</body>
Attention:
You need to restart each time you modify the server configuration!!!
(3) MySQL Database
MySQL is a relational database management system (RDBMS), acquired by Oracle Corporation. is the most popular relational database management system, MySQL is one of the best RDBMS application software in Web application.
3.1 Features:
- An open-source small-scale relational database management system
- Small size, fast speed, low total cost of ownership
- MySQL is widely used in small and medium-sized websites on the internet
3.2 Installation
Download MySQL software Click Install, such as:
3.3 Starting in preference configuration (Click on the image above for system preference management to open the interface)
3.4 Setting the MySQL command alias
Vim ~/.bash_profile
Note:
The. bash_profile file is used to set the environment variables for the current user
Insert the following content:
# mysqlalias mysql= '/usr/local/mysql/bin/mysql ' aliasmysqladmin= '/usr/local/mysql/bin/mysqladmin ' # lsalias ls= ' ls- G
Save exit
Restart the terminal program!!!
3.5 Modifying the MySQL administrator password
Mysqladmin-uroot password "Your password"
3.6 Installing the MySQL management tool
Personal recommendation using Navicat Premium to manage MySQL database, interface is very user-friendly, easy to operate!
Setting up a server environment under a MAC environment