當(dāng)前位置:工程項(xiàng)目OA系統(tǒng) > 泛普各地 > 江西OA系統(tǒng) > 鷹潭OA > 鷹潭網(wǎng)站建設(shè)公司
GAE上搭建PHP環(huán)境并開(kāi)啟URL
申請(qǐng)免費(fèi)試用、咨詢(xún)電話(huà):400-8352-114
鷹潭網(wǎng)站建設(shè)www.diyphp.net1.下載quercus:
http://quercus.caucho.com/
版別當(dāng)然最新的最棒,由于原則上來(lái)說(shuō)新版別對(duì)php援助程度更高,但是在本人測(cè)驗(yàn)的時(shí)分發(fā)現(xiàn)最新的4.0.25存在一點(diǎn)問(wèn)題,所以換用4.0.18版別.
挑選WAR格局的文件下載,使用Winrar解壓,將WEB-INFlib的jar復(fù)制至GAE工程下的warWEB-INFlib目錄
2.裝備Quercus:
在appengine-web.xml中裝備對(duì)php文件的撐持:
- 
		
<static-files> - 
		    <exclude path="/**.php" />  
		
- 
				static-files>  
				
- 
						<resource-files>  
						
- 
								    <include path="/**.php" />  
								
- resource-files>
 
 
 - 
								    <include path="/**.php" />  
								
 
 - 
						<resource-files>  
						
 
 - 
				static-files>  
				
 
在web.xml中增加一個(gè)servlet:
- 
		
<servlet> - 
		    <servlet-name>Quercus Servletservlet-name>  
		
- 
				    <servlet-class>com.caucho.quercus.servlet.GoogleQuercusServletservlet-class>  
				
- servlet>
 
 
 - 
				    <servlet-class>com.caucho.quercus.servlet.GoogleQuercusServletservlet-class>  
				
 
增加對(duì)php文件的映射:
- 
		
<servlet-mapping> - 
		    <servlet-name>Quercus Servletservlet-name>  
		
- 
				    <url-pattern>*.phpurl-pattern>  
				
- servlet-mapping>
 
 
 - 
				    <url-pattern>*.phpurl-pattern>  
				
 
3.完成URL重寫(xiě)(經(jīng)過(guò)UrlRewriteFilter完成):
下載UrlRewriteFilter,將urlrewritefilter-*.jar復(fù)制在工程的warWEB-INFlib目錄下
在web.xml中增加URL過(guò)濾
- 
		
<filter> - 
		    <filter-name>UrlRewriteFilterfilter-name>  
		
- 
				    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilterfilter-class>  
				
- 
						filter>  
						
- 
								<filter-mapping>  
								
- 
										    <filter-name>UrlRewriteFilterfilter-name>  
										
- 
												    <url-pattern>/*url-pattern>  
												
- 
														    <dispatcher>REQUESTdispatcher>  
														
- 
																    <dispatcher>FORWARDdispatcher>  
																
- filter-mapping>
 
 
 - 
																    <dispatcher>FORWARDdispatcher>  
																
 
 - 
														    <dispatcher>REQUESTdispatcher>  
														
 
 - 
												    <url-pattern>/*url-pattern>  
												
 
 - 
										    <filter-name>UrlRewriteFilterfilter-name>  
										
 
 - 
								<filter-mapping>  
								
 
 - 
						filter>  
						
 
 - 
				    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilterfilter-class>  
				
 
在工程的warWEB-INF目錄下新建一個(gè)Url重寫(xiě)裝備文件:urlrewrite.xml
- 
		
xml version="1.0" encoding="utf-8"?> - 
		        "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">  
		
- 
				   
				
- 
						<urlrewrite>  
						
- 
								    <rule enabled="true" match-type="regex">  
								
- 
										      <note>UrlRewritenote>  
										
- 
												      <condition type="request-filename" operator="notfile" name="notfile" next="and"/>  
												
- 
														      <condition type="request-filename" operator="notdir" name="notdir" next="and"/>  
														
- 
																      <from>/(.*)from>  
																
- 
																		      <to last="true" type="forward">/index.phpto>  
																		
- 
																				    rule>  
																				
- 
																						urlrewrite>  
																						
 
 - 
																						urlrewrite>  
																						
 
 - 
																				    rule>  
																				
 
 - 
																		      <to last="true" type="forward">/index.phpto>  
																		
 
 - 
																      <from>/(.*)from>  
																
 
 - 
														      <condition type="request-filename" operator="notdir" name="notdir" next="and"/>  
														
 
 - 
												      <condition type="request-filename" operator="notfile" name="notfile" next="and"/>  
												
 
 - 
										      <note>UrlRewritenote>  
										
 
 - 
								    <rule enabled="true" match-type="regex">  
								
 
 - 
						<urlrewrite>  
						
 
 - 
				   
				
 
這條規(guī)矩就等同于.htaccess中的:
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
注重:這條規(guī)矩可能會(huì)招致GAE本地辦理http://localhost:8888/_ah/admin/失效,由于工夫聯(lián)系就不再批改.
4.測(cè)驗(yàn):
在工程的war目錄下新建一個(gè)index.php文件:
- 
		
php - 
		echo '<pre>';  
		
- 
				print_r($_SERVER);  
				
- ?>
 
 
 - 
				print_r($_SERVER);  
				
 
由于我曾經(jīng)將index.php設(shè)置為welcome文件,所以直接翻開(kāi)http://localhost:8888/
作用如圖所示:
- 1久途-網(wǎng)站制作流程
 - 2企業(yè)建站要寫(xiě)簡(jiǎn)潔的代碼
 - 3網(wǎng)站優(yōu)化中友情鏈接需要注意的問(wèn)題
 - 4評(píng)估企業(yè)站做的好壞的方法
 - 5網(wǎng)站運(yùn)維的小細(xì)節(jié)和操作
 - 6php銜接到MySQL數(shù)據(jù)庫(kù)效勞器時(shí)三種首要的API:mysql,mysqli,pdo差異及聯(lián)絡(luò)
 - 7ecshop中jQuery沖突解決
 - 8PhoneGap新手總是需要一些基礎(chǔ)問(wèn)題的解答
 - 9百度算法更新,為什么站被降權(quán)?
 - 10全站內(nèi)置SEO優(yōu)化機(jī)制
 - 11P2P網(wǎng)貸的特點(diǎn)
 - 12PHP Google的translate API代碼
 - 13玩具租賃商城系統(tǒng)需求5
 - 142014年玩具租賃市場(chǎng)達(dá)8億,如何抓住這市場(chǎng)良機(jī)?
 - 15玩具租賃商城系統(tǒng)需求4
 - 16如何使自己的企業(yè)網(wǎng)站和同行業(yè)的網(wǎng)站不類(lèi)似沖突
 - 17 數(shù)據(jù)庫(kù)操作基類(lèi)
 - 18大規(guī)模網(wǎng)站架構(gòu)
 - 19關(guān)于HTML5當(dāng)時(shí)狀況的若干關(guān)鍵
 - 20Asia-Pacific Economic Cooperation 工商咨詢(xún)理事會(huì)亞太中小企業(yè)峰會(huì)
 - 21Dreamweaver插件
 - 22租賃網(wǎng)站功能介紹
 - 23SQL到NOSQL的思維轉(zhuǎn)變
 - 24網(wǎng)站優(yōu)化企業(yè)的方法
 - 25再次提及貸款風(fēng)險(xiǎn)管理
 - 26企業(yè)信息統(tǒng)計(jì)系統(tǒng)開(kāi)發(fā)方案
 - 27網(wǎng)站改版注意的問(wèn)題
 - 28HTML5的呈現(xiàn)代表著新一波的Web順序辦法
 - 29PHP/MYSQL 查詢(xún)大數(shù)據(jù)
 - 30PHP函數(shù)代碼段
 
成都公司:成都市成華區(qū)建設(shè)南路160號(hào)1層9號(hào)
重慶公司:重慶市江北區(qū)紅旗河溝華創(chuàng)商務(wù)大廈18樓


