Install and configure PhP5

Source: Internet
Author: User
Install and configure PhP5
Www.shellex.cn
The summer vacation is still a long time. I don't want to keep buried in data structures and algorithms. I decided to study PHP in my spare time.
The system is win2k3 SP1 (I have not planned to go to Linux first, but now I usually work in win, learn, and test). Apache 2.0.5.5 was installed in the past, download a PhP5 file today to install the configuration.
: Www.php.net
I downloaded a zip package, not a win installer, because I learned more about manual configuration.
The installation is based on the Apache module, Because CGI cannot be used, and the configuration is poor and there is a security problem.
Add in the HTTP. conf file

# Load the PHP module:
Loadmodule php5_module "D:/PhP5/php5apache2. dll"
# Resolution extension name
Addtype application/X-httpd-PHP. php
# Configure the php. ini path
Phpinidir "D:/PhP5"

The above is my PHP path, which should be changed as needed.
Then add the PHP path to the PATH variable of the system environment variable. My path is D:/php5.
Set a valid configuration file for PHP: PHP. ini. there are two such files in the zip package: PHP. ini-Dist and PHP. ini-recommended. follow official suggestions to use PHP. ini-recommended, because the performance and security are optimized in this file. I have a look at the content in it. It mainly involves some option changes. For the convenience of learning, I open display_errors:
Display_errors = on
Next, write the code in my web root directory... according to the habit, the first program should be hello World, PHP version <HTML>
<Head>
<Title> Hello PHP! </Title>
</Head>
<Body>
<? PHP
Class test {
VaR $ X;
Function _ construct ($ X ){
$ This-> X = $ X;
}

Function display (){
Print ("<p> Hello PhP5! </P> ");
}

Function _ destruct (){
Print ("<p> bye-bye! </P> ");
}
}
$ Tclass = new test (4 );
$ Tclass-> display ();
?>
<Body>
<HTML>

Save as index. php
Open my Firefox and enter 127.0.0.1: 8088
Page output:
Hello PhP5!

Bye-bye!
Well, it's good. www.shellex.cn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.