Cake php host in server with multiple domain

前端 未结 1 1286
-上瘾入骨i
-上瘾入骨i 2021-01-27 07:55

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.co

相关标签:
1条回答
  • 2021-01-27 07:56

    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

    0 讨论(0)
提交回复
热议问题