How to install Bedrock on cpanel Server?

I want to move wordpress to Bedrock.But We are suing cpanel hosting.
also note its my server.I have root user.But server running centOS 7 with cpanel.

The documentation covers installing bedrock. Is something from that documentation not working? What have you tried?

2 Likes

Those docs also mention that Composer is a requirement, which AFAIK can’t run on cPanel unless you have SSH access of some kind.

@tuhin, you will need to install composer and then set your site vhost document root to the web folder as @MWDelaney link suggests.

Although I’m sure it’s not the best practise, what I had to do many times since I wasn’t given SSH access to the shared host is:

Change the config/application.php file as follows:
from:

$webroot_dir = $root_dir . '/web';

to:

$webroot_dir = $root_dir . '/public_html';

Copy all files except the web folder to the root folder of your shared host.
Copy all the content of the web folder into your public_html folder.

And you’re good to go!

If it’s possible to get SSH access then you can do what @40Q mentioned or change the public_html folder to be a link to wherever you want to deploy your website.

1 Like

I can install composer.But Vhost already set on cpanel server.

Think you need to change the installer paths in composer.json?

Currently sat at web/app/ …

Needs to be public_html/app/ … in this case?

I have managed to get Bedrock up and running very successfully onto my shared host. I have got composer installed on the server by my host Guru.co.uk, and under my reseller account I am able to SSH in to run the composer commands.

I have done a step by step process here on a blog post - http://andrewismy.name/installing-bedrock-onto-a-shared-host/

Please do comment or let me know if I have missed something, but the whole site is now bedrock based… Next stage is to develop it further using Capistrano and Git so I can keep it production copy with a dev copy on my laptop…

1 Like

I have SSH access (limited) and can run composer. My site is in a subfolder, not in public_html directly and the page just throws 403. Any ideas what to do there? Gotta point vhost to the right dir I guess, but am at a loss where to do that or how to set it up inside Bedrock.

Also followed @andrew40 instructions but that didn’t work out, 403 still. Also, would like to keep the Bedrock structure as it is, that’s the whole point isn’t it? If it’s important, I’m using Sage for my theme (dont think this should be an issue).

I actually managed to get it to work a bit, but now it wants wp-config; info it doesn’t take .env into account. So mingling with default bedrock structure does not seem like a good idea to me? Would rather just change some settings and that’s it (as it should be, no?) @MWDelaney any thoughts perhaps if I’m not really into using Trellis yet?

Edit: Managed to get it to work (not fully tested yet) via htaccess redirect to /web folder:

So inside Bedrock root where web/ , vendor/, config/ folders are I added .htaccess that redirects everything to /web subfolder but keeps the initial URL. https://stackoverflow.com/questions/2402140/use-a-subdirectory-as-root-with-htaccess-in-apache-1-3

Haven’t found this mentioned anywhere on Roots so I guess it’s not the best solution, but it does work.

Any other tips appreciated.

1 Like

You should have an error log with some more details. Can you please post those?

Hey, indeed I do. Autoloader wanted to be loaded from a different folder than it should have been.
Added htaccess to make it work (see my edited previous comment please).

What is your hosting situation? Unless you can actually set your web root on your host you’re going to have some difficulty.

Who is your host?

It’s a shared hosting with limited CLI access (composer, git …).
It’s a local host from our country, won’t help if I tell.

I do have Cpanel access as well if you think that helps. So I could change my subdomain’s root
to be something like /public_html/subdomains/mydomain/web instead of just /public_html/subdomains/mydomain.

This is what you had in mind?

Edit: yup, tried it, changing to /web actually works, that’s it, so simple :x thanks!

If it’s a subfolder of public_html/web or something then you need to reflect all that in your paths in all the files I mentioned.

As your in a sub folder of the main host folder it may have problems with finding composer.json and other files, as that will be expected in the parent folder, 1 branch up, not two. So you may need to change those paths as well so it can find .env, as it’s looking in the folder above as that’s the standard bedrock install. You can see the folder structure it’s expecting here:

1 Like

If you need to install bedrock which means you need composer and should be run on a terminal.

If your purpose is to migrate your local bedrock project to shared hosting.

  1. Go to your Cpanel and drop all the bedrock files into public_html/your-domain-directory including vendor and web/wp directories.

  2. edit your .env file with shared hosting database details

  3. change WP_HOME value to http://your-domain.com

  4. Go back to Cpanel > Go to domains > edit document root of specific domain to public_html/your-domain-directory/web

Hope this will help.

1 Like