Home > php教程 > PHP开发 > body text

Selection, establishment and use of PHP development environment (2)

黄舟
Release: 2016-12-23 14:26:59
Original
1095 people have browsed it


Okay. There are several installation methods to choose from here, because Zend has done a good job in this regard. If you are going to install Apache as a server, then just install the Zend Studio we downloaded, but its Apache is 1.x Version. And there is no need to manually install PHP, which is very convenient. In fact, for novices, just installing Zend is OK, but why do I need to download so many software. Because not everyone wants to use Zend Studio alone, or Zend Studio does not need to be installed on every machine, or you want to configure a PHP environment that is more suitable for you. So what I want to talk about next is: first configure the PHP running environment, and then install Zend Studio. Everyone, please follow my lead.

Configure PHP

Three of the five software downloaded have zip as the extension. You need a zip decompression software to decompress. You can go to http://www.winzip.com to get the decompression. Compression software, because there are many decompression software and can be obtained in many ways, so I will not explain them in detail here.

In addition, the configuration of PHP4 is slightly different from the configuration of PHP5. For detailed information, please refer to my PHP5 configuration article: http://www.openphp.cn/index.php?module=article&id=12

Change php-x.x.x -Win32.zip Unzip to the root directory of drive C. After decompression is complete, we should be able to find a folder named php-x.x.x-win32 in the root directory of the C drive and rename it to php4. Entering this folder, we can clearly see the directory structure of PHP as shown below:

Selection, establishment and use of PHP development environment (2)

Let me explain a few directories that are useful during configuration:

[dlls] stores the corresponding PHP extension library the required dlls. So what is PHP's DLL extension library? It is an extension of PHP's basic functionality. For example, if you need to use PHP to generate images, then you have to use the GD library extension, which contains a series of image generation functions. In this way, you can easily expand the application scope of PHP. So when you configure PHP, you need to tell PHP that you need support for this extension library.

[extensions] dll of PHP extension library. This is where PHP searches for and stores extension libraries.

[PEAR]PEAR is the storage path of PHP Extension and Application Repository. For more information, please visit http://pear.php.net.

[sapi] Stores the dll file of SAPI.

[go-pear.bat] Files required to install PEAR.

[install.txt]Installation instruction file.

[php4ts.dll] main dll file.

[php.exe]CGI executable program.

[php.ini-dist] PHP configuration file

After explaining these main directories and files, some novices may be afraid, haha, don’t be afraid, put aside these weird names and proper nouns. We install PHP directly, but make a statement first. You can’t make a mistake in the following steps. Be careful, that’s right. Once again, the paths mentioned below, unless otherwise specified, are suitable for all versions of operating systems after Windows 98. I use Windows Server 2003 as a demonstration operating system.

Step one: Copy the php4ts.dll file to the C:Windows directory (if it is a Windows 2000/NT operating system, it is the C:winnt directory, the same below. Please pay attention to the folder corresponding to your Windows version).

Step 2: Copy all .dll files in the [dlls] folder to the C:Windowssystem32 directory (if it is a Windows 2000/NT operating system, it is the C:winntsystem32 directory; if it is Windows 98, it is C :windowssystem directory. The same below. Please note the folder corresponding to your Windows version).

Step 3: Copy the php.ini-dist file to the C:Windows folder and rename it to php.ini. A word of caution here: Do not store the php.ini file in the php directory. In other words, there should be no php.ini file in the C:PHP4 directory (this will not happen if you follow my steps to completely install PHP). Now we already have the php.ini file in the C:windows directory. This file is the PHP configuration file, so the configuration of PHP is also centered around it. Open it with notepad. You can see a lot of English. Friends who are not good at English, don’t be afraid, haha. I'll detail some important configuration options.

I will explain the configuration of each part in order from top to bottom. First, find the Error handling and logging section, where you set the PHP warning level, that is, whether to allow PHP to give corresponding warnings or prompts when an error occurs. Of course, we are learning and debugging PHP, this is necessary. Many lines begin with a semicolon, followed by comments in the *.ini file. We can use these comments to understand the meaning of each warning level. Here we set the alert level to: E_ALL & ~E_NOTICE:

error_reporting = E_ALL & ~E_NOTICE

as shown below:

Selection, establishment and use of PHP development environment (2)

Find the Paths and Directories settings section, where you set the PHP file search path. Use semicolons ";" to separate multiple paths. We set a search path to point to the C:PHP4PEAR directory, remove the semicolon in front of include_path, and change the address in quotation marks to C:PHP4PEAR:

; UNIX: "/ path1:/path2"

;include_path = ".:/php/includes"

;

; Windows: "path1;path2"

include_path = "C:PHP4PEAR

As shown below:

Selection, establishment and use of PHP development environment (2)


Go down a little and find extension_dir. This is the location where PHP searches for extension libraries. Point its path to the C:PHP4extensions folder:

extension_dir = "C:PHP4extensions"

Set as shown below:

Selection, establishment and use of PHP development environment (2)

Find the File Uploads configuration section, where we can set the size of the files that PHP allows to upload (the default is 2M) and the temporary folder where the uploaded files are stored (if the temporary folder is not set, it will be stored in the system by default Temporary folder), we can set it according to our own needs, such as setting the allowed upload size to 8M and setting the temporary file folder to C:TEMP, then we must create a file named temp in the root directory of the C drive folder, remember to remove the semicolon in front of upload_tmp_dir:

; Whether to allow HTTP file uploads.

file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not

; specified) .

upload_tmp_dir = "C:temp"

; Dynamic Extensions, a little further down is the configuration section of Windows Extensions. You can see:

;extension=php_bz2.dll

;extension=php_cpdf.dll

...Selection, establishment and use of PHP development environment (2)

;extension=php_yaz.dll

;extension=php_zip.dll

All supported extensions of PHP are listed here. They are commented out with a semicolon in front, indicating that the current PHP configuration does not support the extension. We can remove the semicolon so that PHP can support these. extension, but because the dlls folder does not contain DLL files for all extensible libraries, we can only install them selectively. If you need to know how to obtain dll files that are not provided in other dlls folders, you can check the "PHP Chinese Manual" ( The relevant parts of its download method will be mentioned later. No explanation here.

The following are some of the more practical PHP extensions contained in the dlls folder:

extension=php_curl.dll: CURL extension support.

extension=php_gd2.dll: GD image library extension support. A series of functions including generating images, etc. are quite useful.

extension=php_ming.dll: Ming library extension support, this extension provides related functions for generating flash files and supports most functions of flash 4.

extension=php_pdf.dll: PDF library extension support, which provides support for functions that operate PDF files.

extension=php_xslt.dll: Provides support for XSLT extension, which provides transformation of XML.

The following lists the configurations of all supported DLL extensions by default. Removing the semicolon indicates support. All we have to do is to determine whether to remove the semicolon. If you don’t know which extensions you need, then to avoid trouble, install it as maximized. The corresponding lines should be set as follows:

; Windows Extensions

; Note that MySQL and ODBC support is now built in, so no dll is needed for it.

;

extension = php_bz2.dll

extExtension = pHP_cpdf.dll

extension = php_crack.dll

extExtension = php_curl.dll

extation = php_db.dl l

extent = php_dba.dll

extension=php_dbase.dll

extension=php_dbx.dll

extension=php_domxml.dll

extension=php_exif.dll

extension=php_fdf.dll

extension=php_filepro.dll

extension =php_gd2.dll

extension=php_gettext.dll

extension=php_hyperwave.dll

extension=php_iconv.dll

;extension=php_ifx.dll

extension=php_iisfunc.dll

extension=php_imap.dll

extension=php_inter base.dll

extension=php_java.dll

extension=php_ldap.dll

extension=php_mbstring.dll

;extension=php_mcrypt.dll

extension=php_mhash.dll

extension=php_mime_magic.dll

extension=php_ ming.dll

extension=php_mssql.dll

extension=php_msql.dll

;extension=php_oci8.dll tension=php_pgsql. dll

extension=php_printer.dll

extension=php_shmop.dll

extension=php_snmp.dll

extension=php_sockets.dll

;extension=php_sybase_ct.dll

extension=php_w32api.dll

extension=php_xmlrpc.dll

extension=php_xslt.dll

extension=php_yaz.dll

extension=php_zip.dll

Find [Session] Part, we only modify one parameter session.save_path here, the default is /tmp, we point it to the C:/TEMP/ directory (use slashes or backslashes to indicate that the path is consistent in PHP), remember to set it on the C drive Create a folder named temp in the root directory:

session.save_path = “C:/temp/”

This is to set the storage path of the session. OK, the configuration of the php.ini file comes to an end. Ctrl+s save the file and close Notepad.

PEAR Installation

PEAR is a good "code warehouse" that provides your code with strong scalability and plays a huge role in improving project efficiency. The new PHP version compressed package already comes with PEAR (not complete), all we have to do is install it. Of course, you must now have a broadband internet connection. If it is a 56k Modem, the installation speed will be very slow.

Click Start -> Run, enter cmd and confirm (if it is Windows 98 operating system, please open the MS-DOS window), open the Windows command prompt window. Follow the following steps:

Enter the PHP directory and enter the commands in the following order:

Enter cd and press Enter to enter the root directory of the C drive:

C:Documents and SettingsAdministrator>cd

C:

Enter cd php4 and press Enter to enter the PHP directory:

C:>cd php4

C:php4>

Enter go-pear.bat and press Enter to start installing PEAR.

C:php4>go-pear.bat

The following welcome message will appear in the command prompt window. The welcome message also mentions the PEAR package that needs to be downloaded, as shown below:

Selection, establishment and use of PHP development environment (2)

Press Enter to continue the installation. Prompt whether to use a proxy to download these PEAR packages. If you want to use a proxy, enter it in the format of http://user:password@proxy.myhost.com:port, otherwise just press Enter. I don’t use a proxy here and just press Enter, as shown below:

Selection, establishment and use of PHP development environment (2)

Check your PEAR package here, and then list the system information. Generally, just press Enter to continue according to the default, as shown below:

Selection, establishment and use of PHP development environment (2)

The PEAR packages that need to be downloaded are listed here, and you will be asked whether to install them. Enter Y and press Enter to start downloading the software packages and complete the installation, as shown below:

Selection, establishment and use of PHP development environment (2)

Installation of MySQL

Place mysql-x.x.x-win The -noinstall.zip folder is compressed to the root directory of drive C (note: when using this version of MySQL, the decompressed folder must be placed in the root directory of drive C). After decompression, you can find a file named mysql in the root directory of drive C. -x.x.x folder. Rename it to mysql . Entering this folder, you can see the directory structure as shown below:

Selection, establishment and use of PHP development environment (2)

Only two directories are introduced here:

[bin] This directory stores the mysql running program, including the terminal and a Mysql management software winmysqladmin.

[data] This directory is the storage directory of the database.

OK, enter the bin directory, find the winmysqladmin.exe file, and open it. The first time you run it you will be prompted to enter a new username and password. Here you can freely select the username and password you need to enter as the default username and password for my.ini. As shown below:

Selection, establishment and use of PHP development environment (2)

Click OK. After confirmation, WinMySQLadmin will shrink to the taskbar in the lower right corner:

Selection, establishment and use of PHP development environment (2)

Right-click on the icon and select Show me to open the main interface of WinMySQLadmin. As shown below:

Selection, establishment and use of PHP development environment (2)

This software displays the basic information of MySQL and can make some simple settings for MySQL, which will not be introduced here. The main interface is as shown below:

Selection, establishment and use of PHP development environment (2)

Let’s see if the MySQL service is started. Open the "Control Panel", then open "Administrative Tools" and then "Services". If everything goes well, we will see the message that MySQL has been started, as shown below:

Selection, establishment and use of PHP development environment (2)

The installation of MySQL comes to an end here, it is very simple.

The above is the content of the selection, establishment and use of PHP development environment (2). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!