Since the creation of the PHP language in 1994, it has magically become the preferred language for website design. The release of PHP 4.0 in 2000 undoubtedly injected fresh life blood into it, and it was also respected for its open source mind. Getting started with learning a programming language is nothing more than learning syntax and basic application examples. During this period of time, I will record the PHP process bit by bit, firstly to summarize myself, and secondly to solve the doubts of subsequent learners who encounter the same problem.
Note-taking is mainly in the form of questions. It will not explore the basics of language bit by bit like a book-based class. Mainly in the basic stage of PHP learning, we foresee problems and record them one by one, and record the process of never understanding them. Well that's where the real PHP language begins.
1): What kind of development environment and development tools does PHP need?
Regarding the PHP language version issue, it is necessary to understand it, but I think it doesn’t matter much. Baidu/google can find these development version issues. If a worker wants to do his job well, he must choose a sharp tool! The first time is to configure the development environment. The development environment I first came into contact with was windows, but this time I am willing to conduct subsequent studies on Linux. Now I will show the deployment of both development environments once.
2): What are the steps for windows installation? What aspects need to be paid attention to?
The first is windows. Generally, for convenience, you will choose to install a tool suite on windows. Here I use WampServer for development. Wamp is the Windows Apache Mysql PHP integrated installation environment, that is, apache and php under windows. and mysql server software. Simple one-click installation and deployment of servers, databases, etc. without having to think too much. You can proceed directly to the next step. However, please pay attention to the following points during the installation process:
1. The path where the WampServer program is located cannot contain Chinese characters and spaces.
2. MySQL default username: root, password is empty
3. MySQL database file storage directory: wampbinmysqlmysql5.5.8data
4. Website root directory [HTML, PHP]wampwww
5. Please use http://127.0.0.1/ (if port 80 is not occupied) to access this machine
6. Non-default port, the URL is http:// 127.0.0.1: Port/
If an IIS server is installed, port 80 is occupied by default. You need to change the wamp service Internet port number: C:wampbinapacheApache2.2.17conf folder has the file httpd.conf Listen Node, change the port number to 80, or whatever you need. After modification, restart all services and run them.
Development tools: PHP development tools: Zend Stodio, PHPedit, EditPlus 2, easyeclipse, DW, etc. can be completed. As an inherited development tool, Zend is easier to use.
3): Is the installation package deployment environment also in the Linux environment? Is there a graphical management interface?
However, we can still develop PHP on Linux. The development environment I chose here is LAMP (linux+Apache+Mysql+PHP). I used the Ubuntu distribution version as an example to install the development environment. The Apache official website card can download the offline installation package or install it online. It is more convenient to choose online installation here. First use the Ubuntu system and enter the window command (Ctrl+Alt+t)
Installation of Apache
As a powerful Web program, Apache is naturally the first choice for building a Web server. Okay, let’s follow Let’s install Apache. Enter the following command in the terminal:
sudo apt-get install apache2
After the installation is completed, the next step is to start Apache
sudo /etc/init.d/apache2 restart
Browse Enter http://localhost or http://127.0.0.1 into the server. If you see "It works!", it means that Apache is successfully installed. The default installation of Apache will create a name under /var. It is the directory of www. This is the Web directory. All Web files that need to be accessible through the browser must be placed in this directory.
PHP installation
Installing software under Ubuntu is a very simple matter. It only requires one command. Execute the following command in the terminal:
sudo apt-get install libapache2-mod- php5 php5
After installation, we need to restart Apache and let it load the PHP module:
sudo /etc/init.d/apache2 restart
Next, we will create a new PHP file under the Web directory To test whether PHP can run normally, command:
sudo gedit /var/www/phpinfo.php
Then enter:
(Note: When using Change bloginfo to phpinfo (because of server restrictions, the phpinfo function cannot be used)
Then save the file and enter http://127.0.0.1/phpinfo.php in the browser. If a page showing PHP operating parameters appears, That means PHP is running normally.
But if the page is not displayed, but you are prompted to download the file, it means that Apaceh has not loaded the PHP module correctly. The solution is to add it to /etc /apache2/apache2.conf or /etc/ Add the following line of command to the apache2/mods-enabled/php5.conf file:
AddType application/x-httpd-php .php .phtml .php3
After adding the above command, pass the following command to apply Restarting Apaceh should solve the problem:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 restart
There is a situation where this expectation does not occur page, it is possible that the folder www does not have appropriate access permissions. You can change the permissions of the www folder through sudo chmod +x ./www. (Those who are familiar with Linux permission management should know this)
MySQL installation
sudo apt-get install mysql-server
At the end of the installation, it will ask for the root password. Note, the root here The password is not the root password of Ubuntu, it is the root password you want to set for MySQL. Of course, if you are willing, you can set it to the same value. Because it is mainly used for local testing, MySQL has been installed here. If it is really going to be used as a server, you may need to refer to other settings. As for these settings, I will use them later. written down.
Okay, the installation of the development environment is over. Let’s wait to write a program that complies with the rules!