Amilkar Contreras
Amilkar Contreras

Reputation: 25

configure DocumentRoot for cakephp 3 in openshift

good I am new user in OpenShift, today I read the documentation, but it was not clear yet, how could I configure DocumentRoot. in my case I use cakephp 3 and for take my application into production I need to configure the DocumentRoot, this should be webroot for production, I am very interested in OpenShift, I just need to get through this problem to carry my applications to the cloud. I read that OpenShift set DocumentRoot but not if it applies to my case.

Upvotes: 0

Views: 396

Answers (1)

ndm
ndm

Reputation: 60463

Well, if it's not possible to change DocumentRoot setting manually (just ask their support), then you could rename your apps webroot directory so that it conforms with OpenShifts automatic document root detection functionality:

[...]

The DocumentRoot is chosen by the cartridge control script logic depending on conditions in the following order:

IF php/ dir exists THEN DocumentRoot=php/
ELSE IF public/ dir exists THEN DocumentRoot=public/
ELSE IF public_html/ dir exists THEN DocumentRoot=public_html/
ELSE IF web/ dir exists THEN DocumentRoot=web/
ELSE IF www/ dir exists THEN DocumentRoot=www/
ELSE DocumentRoot=/

[...]

https://developers.openshift.com/en/php-getting-started.html#set-document-root

Maybe they'd even consider adding webroot to their script if you ask them.

Changing your applications webroot directory

To change your applications webroot directory, you'll need to do two things

  1. Change the directory name as needed (for example to public)

  2. Adjust the WWW_ROOT constant in your apps config/paths.php file accordingly (for example define('WWW_ROOT', ROOT . DS . 'public' . DS);)

Upvotes: 1

Related Questions