php开发环境搭建laravel框架,apache服务器,git版本控制,laravelgit
php开发环境搭建——laravel框架,apache服务器,git版本控制,laravelgit
本文主要阐述做项目前的开发环境安装——后端为php,前端采用grunt进行自动化构建。具体介绍了windows平台下采用apache运行php的环境搭建,以及git工具安装。写得有点粗糙,但过程完整,有不足之处还请见谅。
一、Git工具安装
1)https://github.com 注册github账户
2)安装PHPGit-1.9.5-preview20150319.exe
3)设置Git的user name和email:
$ git config --global user.name "xuhaiyan" $ git config --global user.email "haiyan.xu.vip@gmail.com"
4)生成SSH密钥过程:
1. 查看是否已经有了ssh密钥(用Git Bash,不要用cmd):cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
2. 生成密钥:
$ <span>ssh-keygen</span> -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa(私钥)和id_rsa.pub(公钥)
3. 添加密钥(公钥)到ssh:ssh-add 文件名
登陆github账号,进入公司项目,点击Settings/SSH Keys/Add SSH Key
5)克隆项目代码到本地(假设克隆代码到E:\bd-shop),请填写相应项目代码地址
git clone git@github.com:xxx.git
二、php工具安装
1) 安装php编辑器:Sublime Text Build 3083 x64 Setup.exe
或者安装phpstorm,功能更加强大
三、安装WampServer整合软件包:wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe(32位)
(W: windows系统 ; a:Apache服务器; m:mysql数据库; p:php语言)
可能出现的错误:弹出如下对话框:
解决方法:http://www.microsoft.com/zh-CN/download/details.aspx?id=30679 处下载VSU4\vcredist_x86.exe并进行安装(注意wamp server 是32位的,故装x84,而不是x64)
若出现vcredist_x86.exe安装不了的情况,可以采用nginx启动php,在以后的文章中再讲解。
四、更改apache配置,将Apache服务器主页设置为公司项目:
1)C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf,去掉LoadModule rewrite_module modules/mod_rewrite.so前面的注释符’#’
2)将DocumentRoot 路径设置为E:\bd-shop\public(基于上面第一节中第5点)
3)将
注意:安装无误,但apache启动不了(显示为橙色),则默认80端口已被占用,需要另改端口,端口号设置为1024之后的端口,如8888,8080等,方法如下:
C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf里,
将Listen 0.0.0.0:80 改为Listen 0.0.0.0:8888
Listen [::0]:80 改为Listen [::0]:8888
五、将vendor和.env放到项目中(E:\bd-shop);
vendor为项目的依赖包,因为比较大,用命令下载慢,因此打包好直接用。可根据实际情况处理。
六、安装node-v0.12.7-x64.msi(要装grunt-cli先安装node.js)
七、将node_modules放入bd-shop/resource/assets里面;在E:\bd-shop\resources\assets中启用git bash并写入:
npm <span>install</span> -g grunt-cli
安装好grunt-cli后运行grunt命令,即进行构建(注意grunt和-cli之间没有空格)。
八、安装SQLSRV32.EXE,安装时选择php安装目录中:C:\wamp\bin\php\php5.5.12\ext;然后在C:\wamp\bin\php\php5.5.12\php.ini文件里面,添加下面两行代码:
extension=<span>php_sqlsrv_55_ts.dll extension</span>=php_pdo_sqlsrv_55_ts.dll
九、安装sqlncli.msi;安装msodbcsql.msi(是OBDC驱动)
十、安装Laravel
首先安装composer(Composer-Setup.exe),然后按照官网http://laravel-china.org/docs/5.0/installation 里面步骤进行。
注意:以上的path是指计算机属性/高级系统设置/环境变量/系统变量/PATH

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

Resolve: When Git download speed is slow, you can take the following steps: Check the network connection and try to switch the connection method. Optimize Git configuration: Increase the POST buffer size (git config --global http.postBuffer 524288000), and reduce the low-speed limit (git config --global http.lowSpeedLimit 1000). Use a Git proxy (such as git-proxy or git-lfs-proxy). Try using a different Git client (such as Sourcetree or Github Desktop). Check for fire protection

When developing an e-commerce website, I encountered a difficult problem: How to achieve efficient search functions in large amounts of product data? Traditional database searches are inefficient and have poor user experience. After some research, I discovered the search engine Typesense and solved this problem through its official PHP client typesense/typesense-php, which greatly improved the search performance.

To download projects locally via Git, follow these steps: Install Git. Navigate to the project directory. cloning the remote repository using the following command: git clone https://github.com/username/repository-name.git

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

To submit an empty folder in Git, just follow the following steps: 1. Create an empty folder; 2. Add the folder to the staging area; 3. Submit changes and enter a commit message; 4. (Optional) Push the changes to the remote repository. Note: The name of an empty folder cannot start with . If the folder already exists, you need to use git add --force to add.

Steps to update git code: Check out code: git clone https://github.com/username/repo.git Get the latest changes: git fetch merge changes: git merge origin/master push changes (optional): git push origin master
