


Windows environment configuration Apache+Mysql+PHP_PHP tutorial
I haven’t written a blog for a long time. I am currently learning PHP, so I will share the environment configuration with you. I haven’t blogged for a long time. I am currently learning PHP, so I will share the environment configuration with you.
Software preparation:
The prepared software is shown in the figure below.
Apache has not found a 64-bit version in the official website. Here is an address. It has been tested and can run normally.
Other 32 and 64-bit versions can be found in the official website.
http://www.blackdot.be/?inc=apache/binaries apache 64 bit
Installation of Apache:
Note: This example only takes screenshots that require attention, and other screenshots are not displayed by default.
1. Server information can be configured as default, if the server's 80 port is not occupied by other server programs. Optional "for All Users, on Port 80, as a Service—Recommended." If only for the current user, use 8080Port, start manually, select "only for the Current User, on Port 8080, when started Manually.". The port number can be modified through the configuration file.
2. “Typical” is the default installation, and “Custom” is the user-defined installation.
3. Click "Build Headers and libraries" and select "This feature will be installed on local dirive."
4. You can select "Change" to change the default installation path. In this example, the default installation is used.
5. After the installation is completed, the apache service manager will appear.
There are service projects that can be started now in the service management list.
Note: If the service item apache does not appear in the service management list after installation, it means that an error occurred during the installation process. You can install it manually at this time.
Use cmd to enter C:Program FilesApache Software FoundationApache2.2binThis is the directory where I installed it locally, And execute the httpd -k install command. After success, you can see the apache service in the service management list.
Since this service has been installed normally on my machine, an installation service error is prompted when executing this command. You can search for related execution commands of httpd by yourself.
6. Now you can test whether apache is installed successfully. Enter localhost or 127.0.0.1 in the browser. If you choose not to use port 80 during installation, you need to add the port number when accessing here.
2. You can change the location of the mysql installation directory. In this example, keep the default.
3. After completion, check "Launch the MySql instance Configuration Wizard" to configure MySql.
4. Select the configuration method: "Detailed Configuration (manual precise configuration)", "Standard Configuration (standard configuration)", select "Detailed Configuration",
5. Select the server type, "Developer Machine (development and testing type, mysql takes up very few resources)", "Server Machine (server type, mysql takes up more resources)", "Dedicated MySQL Server Machine (specialized database server, mysql takes up more resources)" All available resources)", generally select "Server Machine". You can choose according to the actual situation. This example uses the development test type.
6. Select the general purpose of the mysql database, "Multifunctional Database (general multifunctional, good)", "Transactional Database Only (server type, focused on transaction processing, general)", "Non-Transactional Database Only (non-transactional) , relatively simple, mainly used for some monitoring and counting, the support for MySAM data types is limited to non-transactional)", select "Transactional Database Only", in this example, the general multi-function type is selected.
7. Configuring the InnoDB Tablespace is to select a storage space for the InnoDB database file. If it is modified, remember the location and choose the same place when reinstalling, otherwise the database may be damaged. Of course, make a change to the database. Backing up is no problem. Use the default location.
8. Select half of the website's mysql visits and the number of simultaneous connections, "Decision Support (DSS)/OLAP (about 20)", "Online Transaction Processing (OLTP) (about 500)", "Manual Setting" , enter a number yourself)" and select "Online Transaction Processing (OLTP)". In this example, the first option is selected because the development and testing work is only done on this machine.
9. Whether to enable TCP/IP connection and set the port. If not, you can only access the mysql database on your own machine. Select "Enable TCP/IP Networking" to enable TCP/IP connection and set the port. If not, If enabled, you can only access the mysql database on your own machine, select "Enable TCP/IP Networking".
10. Set the database language encoding. "Standard Character Set" is Western encoding, "Best Support For Multilingualism" is RTF-8 encoding, "Manual Selected Default Character Set/Collation" is manually set encoding, and gbk and gb2312 are Chinese encoding. Select "Best Support For Multilingualism".
11. Select "Install As Windows Service" to install the MySql service and customize the name of the service.
"Include Bin Directory in Windows PATH" is an environment variable that adds MySql on the machine.
12. Select "Modify Security Settings" and check "Enable root access from remote machines" according to actual requirements to enable access from other machines.
13. After completing the configuration, click "Execute" to execute the configuration.
MySql installation operation has been completed.
Test MySql
-------------------------------------------------- -------------------------------------------------- ----------------------------------------
Installation of Php:
Extract the php-compressed package to the corresponding directory. In this example, I placed it in the E:Program FilesPHP folder.
Configuration of Php:
1.
<span style="color: red; font-size: 10.5pt"> php.ini-development </span><span style="color: red; font-size: 10.5pt">开发用的</span>
4. default_charset="utf-8"
5、
5. Set extension=php_exif.dll, php_gd2.dll, php_imap.dll, php_mbstring.dll, php_mcrypt.dll, php_mime_magic.dll, php_mysql.dll, php_mysqli.dll, php_pdf Remove the semicolon ";" in front of .dll.
6. Add to [PATH] in [Environment Variable]:; E: Program Filesphp; E: Program Filesphpext.
7.
1. When writing PHP programs, this warning sometimes appears: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in D:xxxxxxxxx.php on line 10 . This is because the time taken by PHP is Greenwich Mean Time, so it will be different from your local time. The difference between Greenwich Mean Time and Beijing time is about 8 hours. We can solve it according to the following method: 1. The header uses date_default_timezone_set() to set my default time zone to Beijing time, that is, . 2. Set the value of date.timezone in php.ini to PRC. After setting it, it will be: date.timezone=PRC. At the same time, uncomment this line of code, that is, remove the preceding semicolon.
Configuration of
httpd.conf
:
The location of the httpd.conf file: C:Program FilesApache Software FoundationApache2.2conf.
This is the directory where I installed it locally. Note: There are many tutorials on the Internet saying that you need to copy a certain dll file in the php directory to system32, actually this is not necessary, just load phphttpd.conf >Module is enough.
Add and modify the following statement lines: LoadModule php5_module "E:/PHP/php5apache2_2.dll" (You need to add the "" sign, otherwise apache cannot start)
【ps:
If there is no php5apache2_2.dll
in the installation directory of php, the downloaded version must be wrong.
There are several paragraphs of text on the left side of the official website:
Which version do I choose?
If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP. . . .
So you downloadV6C versions of PHP
VC6 x86 Non Thread Safe
VC6 x86 Thread Safe
One is Thread Safe, the other is Non Thread Safe,
As a result, Non Thread Safe version of php did not have ApacheOptions for :
select the web server you wish to setup
IIS FastCGI
Other CGI
Do not setup a web server
The installation process of Thread Safe version has Apache 2.2.x Module option:
select the web server you wish to setup
Apache 2.2.x Module
Apaceh CGI
IIS FastCGI
IIS CGI
NSAPI
Xitami
NetServe Web Server
Other CGI
Do not setup a web server】
-------------------------------------------------- -------------------------------------------------- --
PHPThere are several different versions to choose from when downloading. That is VC6 X86 and VC9 X86.
First let me answer:
VC6What is it?
VC6 is the legacy Visual Studio 6 compiler, which is compiled using this compiler.
VC9What is it?
VC9 is the Visual Studio 2008 compiler, which is compiled with Microsoft's VS editor .
So how do we choose which version of PHP to download?
If you are using Apache+PHP under windows, please select VC6Version;
If you are using IIS+PHP under windows, please select VC9Version;
What is Non Thread Safe?
Non Thread Safe is non-thread safe;
Thread Safe What is ?
Non Thread Safe is thread safe;
Officially it is not recommended that you use Non Thread Safe in a production environment, so we choose the Thread Safe version PHP to use.
PHPIniDir "E:/Program Files/PHP"
[
If it appears when you connect to the MySql database
Fatal error: Call to undefined function mysql_connect() in C:xxxxx.php
That's because you didn't increase this attribute.
]
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" The default storage path of the project, which can be modified according to the actual situation. Note: If this node is modified, the corresponding DirectoryThe directory of the node also needs to be modified.
DirectoryIndex index.php index.html
Note: The directory separator required in the Apache Windows configuration file httpd.conf is a slash ”/”, and PHP Windows configuration file php.ini is required when writing the directory It’s a backslash ””, don’t get confused.
Configuration test, create index.php in the directory specified by the DocumentRoot node and print the php configuration information.
You know.
-------------------------------------------------- -------------------------------------------------- -----------------------------------------------
1. Download
First download phpMyAdmin from the Internet. You can also download it from the official website of phpMyAdmin at the address: http://www.phpmyadmin.net/home_page/downloads.php and then unzip it to a directory accessible by web . If it is a virtual space, you can After decompression, upload it to the web directory through the ftp tool. At the same time, you can modify the name of the decompressed file.
2. Configuration
Open the libraries directory and the config.default.php file, find the following items in order, and configure them according to the instructions .
1. Visit URL
2. MySQL Host information
Fill in localhost or MySQL ip address of the server, if MySQL and the phpMyAdmin are on the same server, then the default is localhost
MySQL port, the default is 3306, just leave it empty, if you install MySQL If other ports are used, they need to be filled in here.
3. MySQL Username and Password
4. Authentication method
There are four modes to choose from here, cookie, http, HTTP,config;
The config method is to enter the access URL of phpMyAdmin to enter directly without entering the user name and password. It is unsafe and not recommended.
When this is set to cookie, http or HTTP When logging in phpMyAdmin requires data username and password for verification, as follows:
PHP installation mode is Apache , you can use http and cookie ;
PHP installation mode is CGI , you can use cookies.
5. Phrase password (blowfish_secret) settings
6. Modify the interface language
Modify this attribute to zh[Simplified Chinese]
7. TestPhpMyAdmin
7. Well, I have to admit this is an amazing website. The reason is that we did not start this service after installing apache.
8. As you can see, he worked.
Apache is now installed.
-------------------------------------------------- -------------------------------------------------- ----------------------------------------
Mysql installation:
1.Select user-defined configuration here

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

Why can't my code get the data returned by the API? In programming, we often encounter the problem of returning null values when API calls, which is not only confusing...

Mastering Debian system log monitoring is the key to efficient operation and maintenance. It can help you understand the system's operating conditions in a timely manner, quickly locate faults, and optimize system performance. This article will introduce several commonly used monitoring methods and tools. Monitoring system resources with the sysstat toolkit The sysstat toolkit provides a series of powerful command line tools for collecting, analyzing and reporting various system resource metrics, including CPU load, memory usage, disk I/O, network throughput, etc. The main tools include: sar: a comprehensive system resource statistics tool, covering CPU, memory, disk, network, etc. iostat: disk and CPU statistics. mpstat: Statistics of multi-core CPUs. pidsta

Efficient reading of Windows system logs: Reversely traverse Evtx files When using Python to process Windows system log files (.evtx), direct reading will be from the earliest...

Choice of Python Cross-platform desktop application development library Many Python developers want to develop desktop applications that can run on both Windows and Linux systems...

Python binary library (.whl) download method explores the difficulties many Python developers encounter when installing certain libraries on Windows systems. A common solution...
