蛋糕php主机在服务器与多个域 [英] Cake php host in server with multiple domain

查看:102
本文介绍了蛋糕php主机在服务器与多个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含许多域/应用程序的服务器。我需要在该服务器上托管一个蛋糕PHP应用程序。当我上传时,我会收到错误w.r.t urls。



例如,www.xyz.com/aboutus。这个url是工作。有一个控制器叫关于。
但是当我采取url www.xyz.com/aboutus/add,它必须去到Aboutus控制器中的添加方法。它在我的本地系统中工作。但是在实时,它显示添加控制器丢失的错误。



在我的本地,我改变了文档根在apache。但是在实时服务器中,我不能这么做,因为有多个网站。

解决方案

您需要确保 ROOT APP_DIR CAKE_CORE_INCLUDE_PATH 变量已更新到正确的路径。 [详情在这里] (或见



根据CakePHP 2.0版本的规定, .x,更容易更改include_path,但我还没有尝试: http://book.cakephp.org/2.0/en/deployment.html#multiple-cakephp-applications-using-the-same-core p>

我使用的文件结构:

  / cakephp 
/ cakephp_1_3
/ cakephp_2_0_5
/ public_html
/mysite1.com
/mysite2.com
/mysite3.com

// webroot / index.php(我的网站之一)
define('ROOT',DS.'home'.DS.'myusername'.DS.'public_html');
define('APP_DIR',DS.'mysite1.com');
define('CAKE_CORE_INCLUDE_PATH',DS.'home'.DS.'myusername'.DS.'cakephp'.DS.'cakephp_2_0_5'.DS.'lib');

(我只是用了3行来设置变量 - 像这样的行)



不要忘记确保你的数据库设置在 app / Core / Config / database.php

code>


I have a server with many domains/ applications on it. I need to host a cake php application on that server. When I uploaded, I get errors w.r.t urls.

for eg, www.xyz.com/aboutus. this url is working. there is a controller called Aboutus. But when I take the url www.xyz.com/aboutus/add, it must go to the add method in Aboutus controller. It is working in my local system. But in live, it shows the error that 'add' controller is missing.

In my local, I have changed the document root in apache. But in live server I cant do this as there are multiple sites.

解决方案

You need to make sure that the ROOT, APP_DIR, and CAKE_CORE_INCLUDE_PATH variables in each site's webroot/index.php have been updated to go to the right paths. [details here] (or see below where I list my settings) Other than that, just make sure your host has mod rewrite on and you should be good to go.

According the the CakePHP book for 2.0.x, it's easier to just change the include_path, but I haven't tried that yet: http://book.cakephp.org/2.0/en/deployment.html#multiple-cakephp-applications-using-the-same-core

The file-structure I use:

/cakephp
    /cakephp_1_3
    /cakephp_2_0_5
/public_html
    /mysite1.com
    /mysite2.com
    /mysite3.com

//webroot/index.php (of one of my sites)
define('ROOT', DS.'home'.DS.'myusername'.DS.'public_html');
define('APP_DIR', DS.'mysite1.com');
define('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'myusername'.DS.'cakephp'.DS.'cakephp_2_0_5'.DS.'lib');

(I just took the 3 lines that set the variables - they're not really three lines in a row like that)

Don't forget to make sure your database settings are still correct in app/Core/Config/database.php

这篇关于蛋糕php主机在服务器与多个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆