搭建 PHP 環(huán)境
Jun 08, 2016 pm 05:32 PM
所需軟件:
Apache2.2.8 ?? PHP 5.2.5 ?? Mysql 5.0
************************
1. 安裝 Apache
(安裝包格式)
在 Network Domain 和 Server Name 里填入 127.0.0.1,右下角可以控制 Apache 服務(wù)器的啟動與關(guān)閉。安裝好后,在瀏覽器里輸入 http://localhost/,如果出現(xiàn) It works!" 字樣,則說明安裝成功了!
2. 安裝 PHP
(解壓包格式)
解壓文件到 C:PHP 下
3. 安裝 Mysql
(解壓包格式)
解壓文件到 C:mysql 下,從命令提示符里進(jìn)入到 bin 目錄下,執(zhí)行 "mysql-nt -install" 進(jìn)行安裝,安裝成功后,會顯示 "Service successfully installed." 然后啟動服務(wù) "net start mysql",最后更改管理密碼 "mysqladmin -u root -p password
其它相關(guān)命令:
mysqld-nt -remove??? 卸載服務(wù)
net stop mysql??? 停止服務(wù)
4. 軟件配置
首先停止 Apache 服務(wù),然后用記事本打開 C:pacheconfhttpd.conf 文件,找到 "#LoadModule ssl_module modules/mod_ssl.so",在它下面添加 "LoadModule php5_module c:/php/php5apache2_2.dll"。然后找到 "AddType application/x-gzip .gz .tgz",在下面添加 "AddType application/x-httpd-php .php"。
在 C:php 目錄下找到 php.ini-dist 和 php5ts.dll 文件,把 php.ini-dist 復(fù)制到 Windows 目錄下,并且重命名為 php.ini,用記事本打開找到 "extension=php_mysql.dll",去掉前面的分號。把 php5ts.dll 復(fù)制到 system32 目錄里,并且把 C:phpext 目錄下的 php_mysql.dll 文件復(fù)制到 Windows 文件夾下。
5. 配置網(wǎng)站
再次修改 httpd.conf,找到 "DocumentRoot "C:/Apache/htdocs" "、"
6. 搭建完畢
啟動 Apache 服務(wù),配置完成!

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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

To safely handle PHP file uploads, you need to verify the source and type, control the file name and path, set server restrictions, and process media files twice. 1. Verify the upload source to prevent CSRF through token and detect the real MIME type through finfo_file using whitelist control; 2. Rename the file to a random string and determine the extension to store it in a non-Web directory according to the detection type; 3. PHP configuration limits the upload size and temporary directory Nginx/Apache prohibits access to the upload directory; 4. The GD library resaves the pictures to clear potential malicious data.

InPHP,variablesarepassedbyvaluebydefault,meaningfunctionsorassignmentsreceiveacopyofthedata,whilepassingbyreferenceallowsmodificationstoaffecttheoriginalvariable.1.Whenpassingbyvalue,changestothecopydonotimpacttheoriginal,asshownwhenassigning$b=$aorp

The most direct way to find the last occurrence of a substring in PHP is to use the strrpos() function. 1. Use strrpos() function to directly obtain the index of the last occurrence of the substring in the main string. If it is not found, it returns false. The syntax is strrpos($haystack,$needle,$offset=0). 2. If you need to ignore case, you can use the strripos() function to implement case-insensitive search. 3. For multi-byte characters such as Chinese, the mb_strrpos() function in the mbstring extension should be used to ensure that the character position is returned instead of the byte position. 4. Note that strrpos() returns f

MySQL supports transaction processing, and uses the InnoDB storage engine to ensure data consistency and integrity. 1. Transactions are a set of SQL operations, either all succeed or all fail to roll back; 2. ACID attributes include atomicity, consistency, isolation and persistence; 3. The statements that manually control transactions are STARTTRANSACTION, COMMIT and ROLLBACK; 4. The four isolation levels include read not committed, read submitted, repeatable read and serialization; 5. Use transactions correctly to avoid long-term operation, turn off automatic commits, and reasonably handle locks and exceptions. Through these mechanisms, MySQL can achieve high reliability and concurrent control.

Character set and sorting rules issues are common when cross-platform migration or multi-person development, resulting in garbled code or inconsistent query. There are three core solutions: First, check and unify the character set of database, table, and fields to utf8mb4, view through SHOWCREATEDATABASE/TABLE, and modify it with ALTER statement; second, specify the utf8mb4 character set when the client connects, and set it in connection parameters or execute SETNAMES; third, select the sorting rules reasonably, and recommend using utf8mb4_unicode_ci to ensure the accuracy of comparison and sorting, and specify or modify it through ALTER when building the library and table.

The most direct way to connect to MySQL database is to use the command line client. First enter the mysql-u username -p and enter the password correctly to enter the interactive interface; if you connect to the remote database, you need to add the -h parameter to specify the host address. Secondly, you can directly switch to a specific database or execute SQL files when logging in, such as mysql-u username-p database name or mysql-u username-p database name

The reason why header('Location:...') in AJAX request is invalid is that the browser will not automatically perform page redirects. Because in the AJAX request, the 302 status code and Location header information returned by the server will be processed as response data, rather than triggering the jump behavior. Solutions are: 1. Return JSON data in PHP and include a jump URL; 2. Check the redirect field in the front-end AJAX callback and jump manually with window.location.href; 3. Ensure that the PHP output is only JSON to avoid parsing failure; 4. To deal with cross-domain problems, you need to set appropriate CORS headers; 5. To prevent cache interference, you can add a timestamp or set cache:f

To design a reliable MySQL backup solution, 1. First, clarify RTO and RPO indicators, and determine the backup frequency and method based on the acceptable downtime and data loss range of the business; 2. Adopt a hybrid backup strategy, combining logical backup (such as mysqldump), physical backup (such as PerconaXtraBackup) and binary log (binlog), to achieve rapid recovery and minimum data loss; 3. Test the recovery process regularly to ensure the effectiveness of the backup and be familiar with the recovery operations; 4. Pay attention to storage security, including off-site storage, encryption protection, version retention policy and backup task monitoring.
