Configuring APACHE2.2+PHP5+CAKEPHP1.2+MYSQL5 Run Environment _php Tutorial

Source: Internet
Author: User
Tags phpinfo

1. Installation Configuration Apahce

Installation configuration Apache is relatively simple, followed by the Installation Wizard will be able to take a step down. At most, you need to be aware of where to configure the port, if you have installed another Web server that occupies 80 ports, remember to select a different port when you configure it. The wizard forgot the settings, in the Apache conf/httpd.conf to modify the following sentence is good:

Listen 127.0.0.1:80

2. Installation Configuration PHP5

PHP5 is also a way to install the end. To allow Apache to interpret the PHP page, continue to modify the Apache conf/httpd.conf file. First, assume that PHP5 is installed in the D:\PHP5 directory.

The first is to load the PHP5 module into Apache, add the following sentence:

LoadModule php5_module D:/php5/php5apache2_2.dll

Then let Apache know the mime of the PHP page, find the block, add a addtype sentence in this block:

Mime_module >
...
addtype application/x-httpd-php. PHP
...

Finally, the index.php is set as the default page, so that index.php is automatically found when no page is specified for browsing. Locate The block and modify the DirectoryIndex configuration inside:

Dir_module >
directoryindex index.html index.htm index.php

Note here the order of the default pages, according to the above configuration, if there is a directory of both Index.html and index.php in the case, will first find and open index.html.

Finally, Apache will be able to find the configuration for PHP. The general idea is to copy the php.ini to the Windows directory, but I prefer to configure this location in Apache:

Php5_module >
Phpinidir D:/php5/php.ini

OK, now PHP should be configured, write the simplest PHP try-to start or restart the Apache server, In the Apache Htdocs directory to create a new phpinfo.php file (if modified DocumentRoot, according to the modified DocumentRoot decision location), the content is as follows:


Phpinfo();
?>

Now open the browser to see http://localhost/phpinfo.php (not the default port remember write port number) to see the effect.

3. Installation Configuration cakephp

The so-called installation, in fact, is decompression only. First to extract cakephp to D:\cakephp, then cakephp extracted the directory structure is probably like this:

D:\CakePHP
│.htaccess
│index.php
│readme
├──app
│└──webroot
├──cake
└──vendors

From a variety of information on Google, the web app is about three ways to configure, even the order of the introduction has not changed. The second type, that is, does not change the directory structure of CakePHP, there is a certain security, I think it is good, adopted.

Set the App/webroot directory below cakephp to Apache DocumentRoot, then open the Rewrite module (remove the comment symbol) Also configure the AllowOverride property of the DocumentRoot directory to change to all. Then you need to modify the following contents of the Apache configuration file:

...
LoadModule rewrite_module modules/mod_rewrite.so
...
documentroot "D:/cakephp/app/webroot"
...
"D:/cakephp/app/webroot" >
allowoverride All

...

Then restart Apache again, visit http://localhost/, and you should be able to show some of CakePHP's information.

If you configure cakephp with an advanced configuration, you may encounter a warning on the page when you try to run it:

Warning: Cache Not configured properly ....
Warning (2): Array_merge () [Function.array-merge]: ...
Warning (2): Array_merge () [Function.array-merge]: ...

Encounter this problem I really big, check a half-day data, the results in almost despair, do not know where to see a message, said to let the app's tmp/cache/persistent directory has write permission. Check out that the original TMP does not exist in the cache directory, so I created the cache/persistent directory. If you are in the Linux directory, also give this directory 777 permissions.

4. Install the configuration MySQL

MySQL installation is also very simple, after the installation of a wizard to configure some things. These are all things on the database, and it's good to follow the wizard step-by-step. The key is for PHP and cakephp to be able to use the MySQL database.

About the configuration in PHP, directly modify the php.ini, the Extension=php_mysql.dll front of the comment symbol is removed, that is,

...
Extension=php_mysql.dll
...

Then copy the phpinfo.php you just wrote to CakePHP's app/webroot, and then browse http://localhost/phpinfo.php again to see if there is any configuration information about MySQL on the page-probably not. Because there are less things to do--I am depressed, here is the delay of my half time.

There are a lot of DLLs in the PHP5 directory, just copy these DLLs to the Apache Bin directory (if your PHP5 directory is in path, it might not be so troublesome). Now look again, there should be MySQL configuration information on the page.

CakePHP's configuration is in the config/database.php in the app directory. Did you find this file? Have you seen a database.php.default? It would be nice to copy it and rename it to database.php. And, of course, to pity dorado things.

There is only one Database_config class in this configuration, and it has a $default variable, which is the configuration information of the default database. Almost configured like this:

var $default = Array (
' driver ' = ' mysql ',
' persistent ' = False,
' host ' = ' localhost ',
' login ' = ' your-username ',
' password ' = ' Your-password ',
' database ' = ' your-database ',
' prefix ' = ',
);

Note that the login, password, and database three items are configured according to the actual situation. After the configuration is complete, browse for http://localhost/, which should have a "Your database configuration file is present" on this page. ”。 If your database is ready, you will see "Cake is able-connect to the database." ; If you are not ready, you may see some warnings or error messages.

Summary

This configuration is really exhausting. Who is interested in making a complete installation package, according to the installation location of automatic configuration, how good! Or do a GUI or Web interface configuration program is also good.

http://www.bkjia.com/PHPjc/319978.html www.bkjia.com true http://www.bkjia.com/PHPjc/319978.html techarticle 1. Installation configuration APAHCE The installation configuration Apache is relatively simple, followed by the installation Wizard to take a step down can be done. At most, you need to be aware of where the port is configured, if ...

  • 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.