PHP environment configuration for getting started with PHP

Source: Internet
Author: User
Tags echo date getting started with php
I. installation and configuration of php

Rename the decompressed php5.2.1-Win32 folder to php5. And copy it to the C directory. The installation path is c: \ php5.

1. Find the php under the php Directory. ini-dist or php. ini. recommended file, renamed to php. ini, and copy it to the windows directory of the system disk (take c: \ windows as an example ).

2. Copy php5ts. dll and libmysql. dll under the c: \ php5 directory to the c: \ windows \ system32 directory.

3. Copy the php_gd2.dll, php_mysql.dll, and php_mbstring.dll files under the c: \ php5 \ ext directory to c: \ windows \ system32.

If php_gd2.dll php is not loaded, the image cannot be processed. Mysql function libraries are not supported when php_mysql.dll php is not loaded.

Php_mbstring.dll supports wide characters when phpmyadmin is followed.

4 open the c: \ windows \ php. ini file

Set the extension path to find the line extension_dir with extension_dir = "./". Change this row to extension_dir = "C: \ php5 \ ext"

C: \ php5 is the path for installing php. Dll cannot be loaded if the path is incorrect.

(Note: Some php versions are; extension_dir = "./" Remove the semicolon from the previous version)

Search for extension

Extension = php_mbstring.dll

Extension = php_gd2.dll

Extension = php_mysql.dll

Remove the semicolon before the preceding three items so that these DLL files can be loaded at Apache startup.

Of course, we copied these DLL files to system32.

PhP5 Time Difference

<? PHP echo date ("Y-m-d h: I: s");?> Time Difference: eight hours

Why? The Time Zone settings are added for the PhP5 series. The default value is Greenwich Mean Time, which is 8 hours different from the East 8 zone in China.

Find the row in date. timezone

; Date. timezone = SS

Replace;

Date. timezone = PRC

2. Find the httpd. conf shortcut in the Apache configuration file in the Start Menu, open it, and write it in the last line of httpd. conf.

Loadmodule php5_module C:/PhP5/php5apache2. dll

Phpinidir "C:/Windows"

Addtype application/X-httpd-PHP. php

Addtype application/X-httpd-PHP. html

Addtype application/X-httpd-PHP. htm

Alias/shop "D:/myphp /"

<Directory "D:/myphp">

Options indexes Multiviews

AllowOverride none

Order allow, deny

Allow from all

</Directory>

Create a folder newphp under drive D and restart Apache. If no command line prompt is displayed, the preceding configuration is successful. Use http: // localhost/shop/to test Apache running status.

Install and configure Apache, MySQL, and PHP in Linux

1. Obtain the Software Package

Httpd-2.2.4.tar.gz

Mysql-6.0.0-alpha.tar.gz

Php-5.2.2.tar.gz

Download them from the corresponding official website and put them all under/usr/local/src.

2. Install MySQL

The installation of these three software packages should not be sequential, but I am still used to installing MySQL first:

> Tar-zxvf mysql-6.0.0-alpha.tar.gz

> Cd mysql-6.0.0-alpha

>./Configure -- prefix =/usr/local/MySQL

> Make

> Make install

> CP support-files/my-medium.cnf/etc/My. CNF

> Cd/usr/local/MySQL

> Chown-r MySQL.

> Chgrp-r MySQL.

> Bin/mysql_install_db -- user = MySQL

> Chown-r MySQL VaR

> Bin/mysqld_safe -- user = MySQL &

At this point, even if MySQL is installed and started, there are still some work that must be done, such as setting the root password and enabling MySQL to start on its own:

Set the MySQL Root Password:

> Bin/mysqladmin-u Root Password New Password

Set MySQL to boot automatically:

> CP/usr/local/src/mysql-6.0.0-alpha/support-files/MySQL. Server/etc/rc. d/init. d/MySQL

> Chmod + x/etc/rc. d/init. d/mysql

> Chkconfig -- add mysql

3. install Apache

> Tar-zxvf httpd-2.2.4.tar.gz

> Cd httpd-2.2.4

>./Configure -- prefix =/usr/local/apache -- with-mysql =/usr/local/mysql -- enable-module = so -- enable-shared = max

> Make

> Make install

4. install PHP

> Tar-zxvf php-5.2.2.tar.gz

> Cd php-5.2.2

>./Configure -- prefix =/usr/local/php -- with-mysql =/usr/local/mysql-with-apxs2 =/usr/local/apache/bin/apxs

> Make

> Make install

> Cp php. ini-dist/usr/local/php/lib/php. ini

> Vi/usr/local/php/lib/php. ini

Modify register_globals = On

5. Configure httpd. conf

> VI/usr/local/Apache/CONF/httpd. conf

Find "addtype application/X-gzip. tgz" (row 294th) and add

"Addtype application/X-httpd-PHP. php" and "addtype application/X-httpd-PHP-source. PHPs"

Find "directoryindex index.html

"Add index. php before index.html

> VI/usr/local/Apache/htdocs/index. php

Content:

<? PHP

Phpinfo ();

?>

>/Usr/local/Apache/bin/apachectl-K start

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.