-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared Hosting: Can it work? #5628
Comments
public_html (or public) should never be in the URL. Your files should live one level up, with the DocumentRoot pointing to the public directory within the Snipe-IT project. https://my.bluehost.com/hosting/help/274 Assuming your Snipe-IT files are all in |
I’ve seen the mention of “public” should not be in the URL, but to date I haven’t seen an explanation - could you offer a quick articulation of why?
I did set up the bluehost subdomain (and snipe files) to be at /home2/codyjben/public_html/devices - which means the documentroot should be /home2/codyjben/public_html/devices/public/ (if I’m understanding correctly). Is there some compelling reason that I would need to start over in a different folder structure to avoid the word “public”?
I haven’t yet been able to figure out how to change the documentroot in bluehost - I can SSH around the snipeit files but I don’t have root-level access (or at least from the /devices directory in SSH I haven’t figured out where to go to update the documentroot.
I appreciate the quick reply. Thanks for helping me along the path.
…-cb
On May 29, 2018, 4:55 PM -0800, snipe ***@***.***>, wrote:
public_html (or public) should never be in the URL. Your files should live one level up, with the DocumentRoot pointing to the public directory within the Snipe-IT project.
https://my.bluehost.com/hosting/help/274
Assuming your Snipe-IT files are all in /home2/codyjben/, the DocumentRoot should point to /home2/codyjben/public
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Because that's how most modern frameworks work. Files that shouldn't be accessed directly are supposed to live above the document root, so folks can't browse to them.
If your document root isn't set correctly, someone could browse to your .env file, and if your web server isn't configured correctly, it could disclose your DB settings, etc. That's why we put it above the document root.
It's not the word public that is the issue, it's a symptom that you're not set up correctly. If I can browse to The link I pasted above shows you how to set the document root in BlueHost using your cpanel UI. |
Thanks for this. Very helpful to have that perspective. I’ll pick it back up tomorrow to see if I can straighten myself out. I’ll post again with success or next questions.
Thanks!
|
Okay, so I changed the DocumentRoot (in bluehost, I have to remove and readd the subdomain with a new documentroot.)... I'm still running into troubles. When I try to load http:https://my-snipe-it-site/, it shows me When I look at the error_log within the public directory of the snipe files, I see a single line each time I try to load the page:
In app.php, lines 14-16 read:
Is there some way I can double check or adjust what should be registered for this variable? Thanks! |
Did you run |
(Also, run |
I thought I had followed that step, but perhaps not. Ran ls -altotal 256 Trying to load Within the What do we try next? Also, FWIW, I have not yet resolved the original observation that I should not be installing snipe-it in a public_html directory (thus, the snipe-it install is at Very much appreciate the assistance! |
I should also mention that I ran into issues adding an apache user which might be part of my troubles... In SSH, I attempted Running ls -alh storage Thoughts? |
Yeah, if you're on shared hosting, you can't create users like
This usually means you've got a stray space or unenclosed phrase in your .env, or you've got a syntax error in there somewhere. If you want to paste your .env here (redacting the passwords, etc) I can take a look. |
That could be part of the issue. My password within .env actually includes a space; is there some type of enclosure (single quotes?) that would allow my password (with the space) to be correctly interpreted? |
Single quotes should work, per the documentation in the link above. |
The single quotes worked. Thank you. Going to Now, I've got a new issue - on the following page, I receive
What can I do to resolve this one? |
Can you look at your logs? I think that duplicate key error is a false flag. I'd be curious to know what the error was before that one, when you hit the original whoops when you first clicked on You can remove the index by using this query in your phpMyAdmin, or whatever system your shared hosting lets you interact with your databases:
My guess is that the first "Whoops" without a stack trace is the real issue, the migrations ran, but because one of those queries didn't complete right, it thinks it needs to re-run them, thus resulting in the duplicate error. |
I'm not sure I know where that particular log lives - I tried looking at the I ran the Here's the debugged "whoops" page screenshot I saw after the drop index - maybe it will provide you some clues? |
Run this:
And then reload the page you're seeing the whoops on. Docs on error logs are here: https://snipe-it.readme.io/docs/getting-help#section-step-3-check-your-app-and-server-logs |
Hi Snipe. Thanks for all your help here. The saga continues... I'm still having troubles here. This morning I tried: After manually dropping all tables from the database, I loaded
The URL where these appear is So, using the earlier direction (now that I have a database filled with tables), I attempt to run the recommended SQL to set things straight:
I then reload http:https://my-snipeit-site/setup/migrate? in my browser and I am presented with the same PDOException errors I noted above (the 1061 errors). Any thoughts of next steps? Thanks again! |
Drop your tables and clear your cookies again. Before you start the /setup, open your I have no idea why you're running into so many problems here. Setup can be challenging, sure, but this is getting ridiculous. |
Following your steps, we get something different... Dropped tables, changed
Snipe, as long as you're willing to continue with the tips of things to try, I'm thrilled. I've had a good experience with snipe-it on a vps in the past (I don't have access to it now), so I'm happy to go the distance here. Thanks for hanging in there with me. As the original post inquired, "can it be done?", we'll soon know! Ha! Cheers! |
It can be done - that's why we have a shared hosting section. It's just always a little tricky since each shared host is different. Run |
Success! I'm in! I had to add
When I reloaded the page, this time, I saw the setup skin with the message, " Snipe, thanks for your perseverance and support. As you might already know, I wouldn't have made it without you. -- For those who are working to install Snipe-IT on a Shared Hosting platform, it can be done (at least in the case of Bluehost). If you experience troubles, open up an issue here and just keep plodding along. It obviously might take a few back-and-forth adjustments, but it can be done. -cb |
I am working on a Bluehost shared hosting account and hoping to install Snipe-IT on a subdomain to review and test for a possible application... I consider myself a noob, so take it easy/slow with instructions - it's entirely possible I don't know what you're saying. Ha!
As it stands, I think I'm doing pretty good (installed smoothly via ssh, created database/user in cpanel, updated .env file) but stuck on how to change the document root. When I load the subdomain, I am presented with "D'oh. If you're seeing this, your DocumentRoot is set incorrectly. It should be set to the public directory."
In the error log, I see, "[29-May-2018 17:26:32 America/Denver] PHP Fatal error: Class 'Illuminate\Foundation\Application' not found in /home2/codyjben/public_html/devices/bootstrap/app.php on line 14" I believe this is in response to my creating a small test file to attempt to identify the current root that SnipeIT sees:
<html><body>
<?php
$root = dirname( __FILE__ );
echo "<a href='$root'>click here to go to home page</a>";
?>
</body></html>
This results in a URL of the href showing "http:https://devices.[domain].com/home2/codyjben/public_html/devices" as the root directory.
Per prereqs for posting, I have enabled the debug mode in the .env file. Also, I have read the common issues page.
If you need me to dive into the various troubleshooting questions, please let me know. After reading several posts in the issues section, I'm not convinced that I am capable of answering all of the questions, nor their utility considering the focused error ("d'oh!").
The text was updated successfully, but these errors were encountered: