Public libraries-Basic Environment establishment and code specifications

Source: Internet
Author: User
Tags phpinfo

Note: when using the configuration file must first back up a copy, named: name-backup.conf

Public welfare library Platform

I. Environment setup:

1. Modify the default project folder in Apache

In httpd. modify DocumentRoot "xxx/htdocs" to DocumentRoot "E:/source/phpstorm" // modify the default server path <directory "xxx/htdocs"> to <directory "E: /Source/phpstorm "> // modify the Directory

2. Add Apache to parse PHP files

(The downloaded PHP version should be vc6 x86 thread safe, otherwise there is no php5apache2_2.dll file) in httpd. modify # loadmodule vhost_alias_module modules/mod_vhost_alias.so In the conf file and add it in the next line (the location in the quotation marks depends on the directory where PHP is located. If PHP is in the Apache root directory, it is as follows) loadmodule php5_module "PHP/php5apache2_2.dll" // load the PHP parsing module so that Apache can automatically parse the PHP file phpinidir "php" addtype application/X-httpd-PHP. PHP. HTML. htm // enables it to parse PHP, HTML, and htm files

3. To facilitate local testing, add a VM

A. add the file c: \ windows \ system32 \ drivers \ etc \ hosts) 127.0.0.1 www.siyuan.com 127.0.0.1 255.127.0.0.1, that is, it is automatically transferred to the local Vm, enter the default documenroot path set in the VM, and display the default page of directoryindex (if it exists, otherwise, the 404 Not Found error occurs ). B. httpd. open the note include CONF/extra/httpd-vhosts.conf In the conf file // Add the vm c. add the following configuration to the extra/httpd-vhosts.conf file: <virtualhost *: 80> DocumentRoot "E:/source/phpstorm/siyuan" // default path for this Vm, when the browser accesses www.siyuan.com, servername siyuan.com serveralias * .siyuan.com <directory "E:/source/phpstorm/siyuan"> directoryindex index.html index is entered by default. PHP // welcome page of the VM options indexes followsymlinks AllowOverride all order allow, deny allow from all </directory> errorlog "logs/siyuan.com-error. log "customlog" logs/siyuan.com-custom. log "common </virtualhost> D. restart Apache server

4. Enable Apache Domain Name Redirection

In httpd. conf, open the comment loadmodule rewrite_module modules/mod_rewrite.so and change all AllowOverride to all.

5. Enable MySQL support in PHP. ini

Open the Note: Extension = php_mysql.dllextension = php_mysqli.dll // if there is no effect, write as follows: (write the full path) Extension = D: /Program/Apache/PHP/EXT/php_mysql.dllextension = D:/Program/Apache/PHP/EXT/php_mysqli.dll Note: view the effective method, phpinfo (); check whether mysqli is a topic // enter www.siyuan.com. Then, index.html in E:/source/phpstorm/siyuanis automatically displayed. You only need to modify it and add it. <? PHP phpinfo ();?> You can.
// Use SQL:
// 1. Open the system service to run services. MSC and start the MySQL program;
// 2. Add the environment variable to the MySQL bin directory;
// 3. Run mysql-u root-P through the command line and enter the password.
// 4. Exit innoxyzyj and use exit.

5. enable support for imagecreate () function in PHP. ini to draw verification codes conveniently.

Open the Note: Extension = php_gd2.dll // if it does not take effect, you need to write the full path extension = D:/Program/Apache/PHP/EXT/php_gd2.dll. Note: view the effective method, phpinfo (); check whether the column GD exists on the page.

6. Added support for less files in phpstorm.

A. download and install nodejsb. install less: Enter NPM install-G lessc in the nodejs console. in phpstorm, choose file-> setting-> file water-> less (you may need to click + to add less)-> edit-> program to specify C: \ Users \ XXX \ appdata \ roaming \ NPM \ lessc. CMD

7. Add the xdebug module.

A. download the corresponding xdebug. DLL file, placed in the PHP/EXT directory B. in PHP. add the following node to the INI file: [xdebug] zend_extension = D:/Program/Apache/PHP/EXT/php_xdebug-2.2.5-5.4-vc9.dll xdebug. remote_enable = onc. add a PHP Web Application in edit configurations in phpstorm to add a server.

8. Added git support in phpstorm.

A.download gitb.in phpstormspecify the location of git.exe C. VCs-> enable Version Control Integration

9. Configure MYSQL as follows:

A. workbench-> edit-> preference-> SQL queries-> "Safe updates". Forbid is not checked

Ii. Code specifications:

1. the backend framework of the project uses thinkphp3.2.2

Official Website: Workshop. Add the modification instructions in article 3.

2. The project front-end framework uses bootstrap3.2

Official Website: Ghost,/public/JS/Bootstrap. Min. js. If you do need to modify any code, please ask for my advice and add the modification instructions in article 3.

3. jquery version 1.11.1

Http://jquery.com/

4. validform is used for form verification.

Official Website: http://validform.w.boy.cn/click "Validate" to verify data-validate = "true" in the form. For the format to be verified, see the official validform documentation.

Iii. Modification description:

1. Modify the thinkphp framework:

A. add a custom HTML Tag and add sy under/thinkphp/library/think/template/taglib. class. PHP file B. to delete a session after one verification modification, run E: \ source \ phpstorm \ siyuan \ thinkphp \ library \ think \ verify. class. add the $ Delete variable in PHP.

2. Modify the bootstrap framework:

A. re-specify the Font Resource file: In/public/CSS/bootstrap3.2.0/variables. in less, modify the following: @ icon-font-path :".. /fonts/"; change to @ icon-font-path:"/public/fonts /";

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.