Write a PHP project deployment process once

Source: Internet
Author: User
Tags php language mysql login

First introduce the basic situation of the project: Using PHP language development, the database is using the MySQL 5.5,http server is Apache 2.2. 10 in the morning to the computer room looked at the basic situation of the server: Windows 2000 operating system, no Apache installed, no PHP, fortunately, the MySQL database has been installed for me to save some things. But happy a little too early, the computer room teacher told me that she did not know the MySQL login password. Without the password my project will not be able to connect to the database, basically waste. Re-install MySQL is useless, because the original password after the removal of MySQL will still remain in the system, if you want to change the password, still need to enter the original password. The old brother after the deployment of data, there is a MySQL password, but is wrong, no way, can only resort to the almighty "brother Gu".

The solution that was just started mostly referred to a program Mysqld-nt.exe in the Bin folder in the MySQL installation directory, by calling the program and passing it the "--skip-grant-tables" command to tell MySQL to skip the password verification process at login, That is, you can log in successfully without entering your password. But I can not find this mysqld-nt program in my bin directory ah, strange, continue to Google, found that the original MySQL from version 5.1 after the start of the program has no mysqld-nt, replaced by Mysqld.exe, so this method will not work.

Play "Not to the Yellow River does not give up" spirit, continue to Google, finally let me find a suitable for my MySQL database version of the solution, here is attached link: The Windows environment in the MySQL forgot root password solution. The basic idea is the same: it is the first to shut down the MySQL service, and then use the MYSQLD program to skip the security check, log in to the database and find the user table in the MySQL library, modify the user table root password, and finally re-open the MySQL service can be logged in with a new password.

After the database is done, copy the PHP5 folder that I used to develop it to the server, because when the development has already opened the required extensions, there is no need to repeat the operation. The only thing that needs to be modified is the "Extension_dir" configuration item in the php.ini configuration file, which designates it as the location of the PHP extended Dynamic Link Library folder on the server. Because the MySQL database is used, the Libmysql.dll file needs to be copied to C:/windows/system32.

Then install the Apache server, using the MSI installer, simple all the way next will be. After installation, the httpd.conf file needs to be modified.

1. Loading PHP Module

Open the httpd.conf file, locate "#LoadModule vhost_alias_module modules/mod_vhost_alias.so", and add the following after it:

1234 LoadModule php5_module "C:/php/php5apache2_2.dll"AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phpsPHPIniDir "C:/php"

The content inside the quotation marks needs to be modified to the path of the PHP folder on the server.

2. Modify the Listening port

Because Tomcat is installed on the server, it uses the Apache default port of 80, so you need to modify Apache's listening port, otherwise Apache will not boot. Locate "Listen 80" in the httpd.conf file and modify port 80 to a different port.

3. Add Directory Homepage

Apache default directory Home page only index.html this one, but the first page of the project is index.php, find the "DirectoryIndex" item in the httpd.conf file, add "index.php" later.

Finally, import the pre-written SQL files in the database, create the database, and copy the project to the Apache document root, modify the user name and password used by the database connection in the project configuration file, start the server, enter the project access address in the browser, everything is OK. Good, deployment success, Finish, eat! \ (^o^)/

PHP Environment (Apache,php,mysql) Detailed configuration method

Pre-installation: Download Php,apache,mysql installation package, can be downloaded to the relevant official website, the following is the installation steps

1. Install Apache , run the installation directly, we will install it in the d:/php/apache/directory

2. put the contents of the php Compressed package into the specified php directory (you specify this is d:/php/, Rename to PHP5 and rename the PHP. Inidevelopment in the PHP5 directory to php.ini )

3. Modify the Apache configuration widget (D:\PHP\Apache\conf\httpd.conf)

1. Loading PHP module in Apache config file add

LoadModule php5_module "D:/php/php5/php5apache2_2.dll" //d:/php/php5/ for PHP installation directory

2. Add addtype application/x-httpd-php. php. phtml // set Apache solution File Type

Specify the PHP configuration file path

3. Add phpinidir "D:/PHP/PHP5" to set up php config file directory (first make sure PHP in the PHP installation directory .) Inidevelopment renamed to php.ini)

4. Restart Apache

5. Verify that PHP is installed successfully

Here we create a phpinfo.php file under the D:\PHP\Apache\htdocs directory to enter the following content

[PHP]View Plaincopyprint?
    1. <?php
    2. Phpinfo ();
    3. ?>

Then open the browser input http://localhost/phpinfo.php, the default is 80 port, if not 80 port localhost after the port number must be added, if the installation is successful, then open the PHP related information page, otherwise check the relevant directory is installed correctly

6. Install the MySQL service, run the MySQL installation file directly, follow the steps to perform the installation operation

5 Add Mysql module

1. Locate libMysql.dll or php_mysql.dll and Php_mysqli.dll in the PHP5 directory in the EXT directory Copy to C drive under Windows directory

2. Open the PHP configuration file

1. Remove extension=php_mysql.dll and extension=php_mysqli.dll front semicolon

2. Set the extension path extension_dir= "d:/php/php5/ext" in PHP. ini

3. Restart Apache

4. Revisit the phpinfo.php page in the browser, if the page information is more than the MySQL and mysqli column indicates that the module was added successfully, otherwise recheck the above steps

Verify that MySQL is

Write a PHP project deployment process once

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.