Solving PHP server installation problems for you_PHP tutorial
We all know the powerful functions of PHP. We will give a detailed introduction to the PHP server installation that everyone is worried about and share it with you. Please follow the steps below and come and try the PHP server. Install it!
- Go to www.apache.com to download an http server, and then go to www.php.com to download the php package, which will be used as a module of the apache server. The latest version of the apache http server is now 2.2 .3. This is what I downloaded at the beginning. The installation process is very simple. Then install the php package. The latest version is 5.1.6. It is also very simple. Unzip it to any place, such as C:php, and then put the folder path C :php is added to the environment variable path. Configure php: Copy php.ini-recommended in the php folder to php.ini and it will be ok. Change the apache server to add the php module: Add: to the conf/httpd.conf file:
<ol class="dp-xml"> <li class="alt"><span><span># For PHP 5 do something like this: </span></span></li> <li class=""> <span>LoadModule php5_module "C:/php/php5apache2.dll" </span><strong><font color="#006699"><span class="tag"><</SPAN><SPAN class=tag-name>----</SPAN></FONT></STRONG><SPAN> LINE 117 </SPAN></SPAN><LI class=alt><SPAN>AddType application/x-httpd-php .php </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN># configure the path to php.ini </SPAN><LI class=""><SPAN>PHPIniDir "C:/php" </SPAN></LI></OL>
Copy after loginThen restarted the apache server, and the result was an error:
<OL class=dp-xml><LI class=alt><SPAN><SPAN>httpd.exe: Syntax error on line 117 of C:/apache/conf/httpd.conf: Cannot load C: </SPAN></SPAN><LI class=""><SPAN>/php/php5apache2.dll into server: The specified module could not be found. </SPAN><LI class=alt><SPAN>Note the errors or messages above, and press the </SPAN><STRONG><FONT color=#006699><SPAN class=tag><</SPAN><SPAN class=tag-name>ESC</SPAN><SPAN class=tag>></span></font></strong><span> key to exit. 20... </span> </li> </ol>
Copy after loginIt took me two hours...crying...Solution: next 2.0.59 The apache server is ok. The previous error is caused by a version problem. To check whether it is installed, save the following code as hello.php and put it in htdocs under the main folder where the apache server is installed. Run the server and browse Enter: localhost/hello.php in the server to view.
<ol class="dp-xml"><li class="alt"> <span><strong><font color="#006699"><span class="tag"><?</SPAN><SPAN class=tag-name>php</SPAN></FONT></STRONG><SPAN> </SPAN></SPAN><LI class=""><SPAN>$</SPAN><SPAN class=attribute><FONT color=#ff0000>time</FONT></SPAN><SPAN class=attribute-value><FONT color=#0000ff>time</FONT></SPAN><SPAN> = time(); </SPAN></SPAN><LI class=alt><SPAN>$</SPAN><SPAN class=attribute><FONT color=#ff0000>thetime</FONT></SPAN><SPAN> = </SPAN><SPAN class=attribute-value><FONT color=#0000ff>date</FONT></SPAN><SPAN>("l, jS F Y g:ia",$time); </SPAN></SPAN><LI class=""><SPAN>echo "Hello world! The time is currently". $thetime ."."; </SPAN><LI class=alt><SPAN></SPAN><SPAN class=tag><STRONG><FONT color=#006699>?></span></font></strong></span><span> </span> </li></ol>
Copy after loginHey, I encountered a new problem the next day, unable to connect to the database, and the error message was:
<ol class="dp-xml"><li class="alt"><span><span>Call to undefined function mysql_connect() in ... </span></span></li></ol>
Copy after loginThe reason is PHP5 unbundles the mysql client, and we need to change the configuration file ourselves. Uncomment the extension php_mysql.dll, and then set the extension_dir and it will be ok. There is no problem with my configuration, and the ddl files are also in the right place, but the problem remains the same, so in the end I had to Changing the software version again, I changed php to 4.4.4. Because 4.4.4 automatically configures mysql, there is no need to change php.ini. You only need to edit the apache configuration file:
<ol class="dp-xml"> <li class="alt"><span><span>#LoadModule php5_module "c:/php/php5apache2.dll" </span></span></li> <li class=""><span>LoadModule php4_module "c:/php/sapi/php4apache2.dll" </span></li> <li class="alt"><span>AddType application/x-httpd-php .php </span></li> </ol>
Copy after loginYou can use this PHP server installation test code to test:
<ol class="dp-xml"><li class="alt"> <span><strong><font color="#006699"><span class="tag"><?</SPAN><SPAN class=tag-name>php</SPAN></FONT></STRONG><SPAN> </SPAN></SPAN><LI class=""><SPAN>echo phpinfo(); </SPAN><LI class=alt><SPAN>$</SPAN><SPAN class=attribute><FONT color=#ff0000>link</FONT></SPAN><SPAN> = </SPAN><SPAN class=attribute-value><FONT color=#0000ff>mysql_connect</FONT></SPAN><SPAN>('localhost', 'root', '123456'); </SPAN></SPAN><LI class=""><SPAN>if (!$link) { </SPAN><LI class=alt><SPAN>die('Could not connect: ' . mysql_error()); </SPAN><LI class=""><SPAN>} </SPAN><LI class=alt><SPAN>echo 'Connected successfully'; </SPAN><LI class=""><SPAN>mysql_close($link); </SPAN><LI class=alt><SPAN></SPAN><SPAN class=tag><STRONG><FONT color=#006699>?></span></font></strong></span><span> </span> </li></ol>
Copy after loginThe gratifying thing is that this time I can find the mysql_connect method, but there is a new error:
<ol class="dp-xml"><li class="alt"><span><span>Client does not support authentication protocol </span></span></li></ol>
Copy after loginI almost want to give up at this point! Thinking of the importance of PHP, I finally gritted my teeth and persisted. This error is because the cryptographic algorithm of the mysql client program in php4 is incompatible with the new mysql server. There seems to be only one solution for php4. Just execute the following command in mysql:
<ol class="dp-xml"> <li class="alt"><span><span>mysql</span><span class="tag">></span><span> UPDATE mysql.user SET </span><span class="attribute">Password</span><span> = </span><span class="attribute-value">OLD_PASSWORD</span><span>('newpwd') </span></span></li> <li class=""> <span>-</span><span class="tag">></span><span> WHERE </span><span class="attribute">Host</span><span> = </span><span class="attribute-value">'some_host'</span><span> AND </span><span class="attribute">User</span><span> = </span><span class="attribute-value">'some_user'</span><span>; </span> </li> <li class="alt"> <span>mysql</span><span class="tag">></span><span> FLUSH PRIVILEGES; </span> </li> </ol>
Copy after login

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

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

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,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

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.

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.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.
