2010-10-22 44 views
4

INSTALLING CakePHP的傻瓜UPDATE CakePHP的 - 所請求的URL不在此服務器

如果你像我一樣,你感到沮喪與這些框架,如Ruby on Rails和CakePHP的,其承諾的快速發展,儘管低迷開始上找到 - 只需花幾個小時安裝。

爲了讓CakePHP運行,扔掉教程,甚至不打擾購買書籍或閱讀文檔。他們沒有提及確切地做到這一點,但是這是什麼需要在Mac 10.6.2完成:

1) Install CakePHP to Sites and unzip it. Rename it to your application name. 
2) Now your httpd.conf file can be located anywhere on your mac. Each tutorial assumes it's located at some place in the depths of virtual reality. But in reality all you need to do is use the handy unix command locate from the terminal: locate httpd.conf 
4) Then whip out your editor: mate httpd.conf 
5) make sure your DocumentRoot says this: DocumentRoot "/Library/WebServer/Documents" 
6) make sure under Directory it says AllowOveride All and Allow from all. It should have this by default but you never know when your sister randomly screws with your computer. Just be glad you have a mac and don't have to deal with her infesting your computer with viruses. 
7) Obviously you want the php module uncommented: LoadModule php5_module  libexec/apache2/libphp5.so 
8) Now if you're like me, you dont want to type http://localhost/~jmerlino/mysite. You want to type http://localhost/mysite. So launch the hosts file. Again all you have to do is locate /etc/hosts and then mate /etc/hosts, assuming you're using TextMate. If you're using BBEdit, then obviously you won't be using the mate command. 
9) Add this line: 127.0.0.1 localhost/mysite. This allows you to now use http://localhost/mysite. 
10) Now the crazy part. find yur username.conf. For me, it's /etc/apache2/users/username.conf. For you, you do locate and make sure it's same spot. 
11) Add the following: 
<VirtualHost *:80> 
ServerName localhost/sitename 
DocumentRoot "/Users/username/Sites/" 
</VirtualHost> 
12) Don't put username. Put whatever your user name is. 
13) Then run your app off http://localhost/mysite. 
14) Don't forget to sudo apachectl restart when you're finished. 

如果你有問題了,這並不意味着你應該放棄編程,成爲一個管道清潔劑。只要不斷嘗試。請記住,您無法在一個在線教程中找到解決方案。

+0

嘗試從「DocumentRoot」設置中刪除「app/webroot」?或者那些文件夾實際存在? – drudge 2010-10-22 23:33:13

+0

我曾嘗試將其從DocumentRoot設置中移除。奇怪的是,錯誤依然存在。是的,這些文件確實存在。我在另一個瀏覽器上嘗試過,因爲我認爲cookie可能是問題。我也重啓了apache。但仍然存在同樣的錯誤,儘管從documentroot刪除app/webroot。 – JohnMerlino 2010-10-22 23:43:08

回答

0

我建議你按照bakery的安裝說明和this博客的設置。也看看這個ticket

+0

您的指示說壓低/庫/ Web服務器/文件 所以我做 它說 在/ Library/Web服務器/文件類型: LN -s /用戶/用戶名/網站/餅 所以我 然後編輯您的httpd.conf文件。那就在這裏。 /etc/httpd/httpd.conf 不幸的是,這裏沒有這樣的文件。該文件位於 /private/etc/apache2/httpd.conf 因此,我去那裏,並進行以下更改: DocumentRoot「/ Library/WebServer/Documents/cake/app/webroot」 AllowOverride All已被設置爲全部 sudo apachectl restart 現在我無法連接頁面 – JohnMerlino 2010-10-23 00:30:05

+0

現在我根本無法連接。 – JohnMerlino 2010-10-23 00:30:57

+0

我將DocumentRoot改回了/ Users/jmerlino/Sites,現在它似乎正在工作。我沒有讀過這些教程,也沒有提到你提供的這些內容。但是,這是你發送的第三個問題的最終提醒我檢查/ Users/jmerlino/Sites的stackoverflow鏈接。 – JohnMerlino 2010-10-23 00:49:58

0

更改您的Web服務器配置中的document_root。例如:document_root /var/www

將其更改爲document_root /var/www/cakedocument_root應指向您的項目。

0

編輯應用程序中的文件core.php中/配置/ core.php中

在代碼 找到這一行定義( 'ABSOLUTE_URL',FULL_BASE_URL 「」); 並將其更改爲define('ABSOLUTE_URL',FULL_BASE_URL."subdirectory_name"); 例如:define('ABSOLUTE_URL',FULL_BASE_URL."/cake");

相關問題