Home > Backend Development > PHP Tutorial > Solving PHP server installation problems for you_PHP tutorial

Solving PHP server installation problems for you_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-15 13:27:31
Original
862 people have browsed it

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 login

    Then 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 login

    It 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 login

    Hey, 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 login

    The 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 login

    You 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 login

    The 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 login

    I 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

    www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446521.htmlTechArticleWe all know the powerful functions of PHP. We will give a detailed introduction to the PHP server installation that worries everyone, and Let’s share it with everyone. Please follow the steps below, come on...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template