cakephp and ispconfig

Discussion in 'Tips/Tricks/Mods' started by kennethlmartin, Oct 25, 2010.

  1. kennethlmartin

    kennethlmartin New Member

    I'm trying to move my cake core folder and app folders outside of my web root directory. Everything works fine when I place all my files in the "web" directory but when I move them outside of this directory I can't access them using the absolute paths to where I want these directories located. In cakephp you can edit these settings in the config file to do what I want and they work on my my local machine and on another server not running ispconfig. Am I getting the paths wrong or is there permissions issues resulting from ispconfig. Any help would be great because leaving all these folders in the web root directory is not ideal.

    from cakephp's index.php file in web root.

    Code:
    /**
     * These defines should only be edited if you have cake installed in
     * a directory layout other than the way it is distributed.
     * When using custom settings be sure to use the DS and do not add a trailing DS.
     */
    
    /**
     * The full path to the directory which holds "app", WITHOUT a trailing DS.
     *
     */
    	if (!defined('ROOT')) {
    		define('ROOT', DS . 'var' . DS . 'www' . DS . 'clients' . DS . 'client0' . DS . 'web5');
    	}
    /**
     * The actual directory name for the "app".
     *
     */
    	if (!defined('APP_DIR')) {
    		define('APP_DIR', 'app');
    	}
    /**
     * The absolute path to the "cake" directory, WITHOUT a trailing DS.
     *
     */
    	if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    		define('CAKE_CORE_INCLUDE_PATH', DS . 'var' . DS . 'www' . DS . 'clients' . DS . 'client0' . DS . 'web5');
    	}
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    PHP files are only allowed in the web folder for security reasons. If you want to have files outside of the web dir, then you have to add the path that you want to use to the open basedir path on the options tab of the website settings.
     
  3. kennethlmartin

    kennethlmartin New Member

    I ended up just adding
    Code:
    DocumentRoot /var/www/clients/client0/web5/web/app/webroot
    to my Apache directives settings under the websites options tab. Seems to work fine and now my app and cake core directories are inside the /web directory so they're accessible to php and outside the document root directory.

    Although now document root is declared twice but I don't know if that is going to be a problem at all...
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats hosuld not be a problem as declarations that come later in the file simply override the first one. But you will not ba eable to access statistics anymore. Adding your path to the open_basedir will be the cleaner solution.
     
  5. kennethlmartin

    kennethlmartin New Member

    It appears that the open_basedir text box only allows so many characters. Is there another place I can input this information for longer file paths that may not fit here or can I remove subdirectories like ./domain.com/web and just have ./domain.com here
     
  6. astewart

    astewart ISPConfig Developer ISPConfig Developer

    It's true :(
    The php open_base dir field is limited by characters
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Install the 3.0.3.1 RC1, the field has been extended there. But I really dont know how you could have reached the limit in the current ispconfig 3.0.3 as it is already 64 000 chars.
     
  8. kennethlmartin

    kennethlmartin New Member

    255 characters actually...
     
  9. Turbanator

    Turbanator Member HowtoForge Supporter

    I'm curious why you need to make any changes at all. I have cakephp sites running and didn't make any changes at all. Using the standard cake layout of web/app/webroot/ with the .htaccess handling the redirect.

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
    </IfModule>
     
  10. kennethlmartin

    kennethlmartin New Member

    It's true you can just plop the whole thing in the web directory but for a production site you should remove both your app and cake core directories from your document root and you can tell your application where you've placed directories in the index.php file located in your webroot. I also like to have one cake core directory serving multiple applications as well.
     
  11. gawry

    gawry New Member

    I'm trying to run cakephp with ispconfig but with no success.

    Right now I have two problems.

    I'm getting a 500 Internal server error when using the .htaccess that Turbanator mentioned. I was able to make it work setting a different DocumentRoot.

    I was writing this and then i tested again. DocumentRoot works for the front page but everything else seems to get a 404.

    And my database server is refusing external connections. (I have a separate mysql server). Is there a way to make ISPConfig make the mysql accept connections from the web server by default?
     
  12. falko

    falko Super Moderator ISPConfig Developer

    Did you check Apache's error log?

    Does MySQL listen on all interfaces? What's the output of
    Code:
    netstat -tap | grep mysql
    ?
     
  13. gawry

    gawry New Member

    I've solved the configuration problem. I'm not really sure of what happened but i've made it to work without adding the DocumentRoot.

    Code:
    tcp        0      0 *:mysql                 *:*                     LISTEN      11912/mysqld
    
     
  14. gawry

    gawry New Member

    I believe I was not clear. I've solved the apache configuration problem. I believe that mysql users still need to be manually allowed get access from another server.
     
  15. gawry

    gawry New Member

    I have a separate server for MySQL and the databases i create in ispconfig cant be acessed from the webserver ( which is another machine )

    Is there a problem in my configuration or ISPConfig does not handle proper configuration of user access in mysql databases that are located in a different server?
     
    Last edited: Sep 3, 2011
  16. falko

    falko Super Moderator ISPConfig Developer

    Can you check the mysql.user table on the separate MySQL server and check if the Host column holds the correct hosts that are allowed to connect? Also, is MySQL listening on all interfaces? You can check that with
    Code:
    netstat -tap | grep mysql
     
  17. gawry

    gawry New Member

    The funny thing is that i've added both ip's from the webserver when i was adding the mysql user. Even doing this it didn't work. It only worked when i added a wildcard( '%' ) as the host.

    Code:
    tcp        0      0 *:mysql                 *:*                     LISTEN      11912/mysqld    
    tcp        0      0 db.domain.com:60468  web.domain.com:mysql TIME_WAIT   -    
     
  18. falko

    falko Super Moderator ISPConfig Developer

    Maybe you should have used hostnames instead of IP addresses. That might be the problem. But it's good to hear that you at least got it going with wildcards. :)
     

Share This Page