CI4 on shared hosting return error 500 |
Hi all,
I have some problem to try the new CI4 on the main shared hosting I use for me and customers. This is the FTP main root and what I can or cant do with it: - cgi-bin - conf - htdocs - .htaccess So... 1. I can't upload files inside root. 2. This is the .htaccess content: Code: ErrorDocument 403 /__tmp/index.shtml 4. I can upload inside cgi-bin folder too. 5. PHP version, currently 7.2 (7.3-7.4 not available) First try; put all files inside htdocs, than load - website.tld/public/ - website.tld/public/home/ - website.tld/public/index.php/home Error 500 Second try: put public contents inside htdocs put all other inside cgi-bin index.php > added cgi-bin/ on path definition Error 500 I prefer the second way, to put only public content inside htdocs, but I can't find any way to make it working correctly... I tried also to remove ci4 public .htaccess, nothing. Thank you for any suggestion. PS: If someone what to suggest some ready to go domain that give no issues with initial ci4 files, please let me know in PM, just not to advertise here external websites...
Hi, do you have access to your cPanel(?) error logs? And can you check writable\logs folder.
No logs, this is the panel pages (not cpanel):
Manage FTP/Panel pass Manage Pop/Imap accounts Alias/Forward mails DNS service Redirects Reset all Create or edit db Config PHP version HTTPS/HTTP/2 Webmail File manager (same folders as FTP, no logs) PhpMyAdmin Setup wordpress Backup Autofix Used space and service status Server info PHP info CGI/PERL info Inside "conf" folder there is php.ini, I tried to uncomment this one: error_log = php_errors.log And reload ci4 public/ but nothing appear inside any folder...
Have you asked the host provider if they can change it so you can upload to the main root?
If they say no, get a new provider.
Done, their reply:
- Can't upload in main root; - Don't give error logs; - I must debug it (without logs/info about the error) or I must pay their tech dude to solve the issue. Any suggestion about not so expansive provider for small websites will be appreciated (in PM). If someone would suggest, in the meanwhile, something to try before provider change that could solve the issue, let me know. Thank you!
(03-02-2020, 06:41 AM)Waithere Wrote: Done, their reply: Just to be sure we are all using the same terminology, "main root" is the same folder level as htdocs and conf? Or asked another way, you cannot create folders alongside htdocs and conf?
>Or asked another way, you cannot create folders alongside htdocs and conf?
Exactly, I cant create folders alongside htdocs and conf. I can put files inside htdocs or conf or cgi-bin. With CI3 it worked with public files inside htdocs, and all other folders (app/sys) inside cgi-bin. The main problem here is about CI don't work also if I put all the CI4 files inside htdocs and I try to load website.tld/public/. I think If I can solve this, than I can use cgi-bin or conf for "not public" ci folders.
I get the impression that CI4 defaults to all app, system and writable folders in the index.php parent directory. This can be changed.
Run index.php but point halt/die; at the point where it is calling the app/paths. Change the calling path to wherever your app folder is located and make the necessary changes to the paths. echo getcwd(); die; frequently to find out the directory and adjust relative paths. When I am back on the desktop I will check the path file names. Edit: Wherever the writable folder is located it needs to be writable: sudo chmod -R 0777 writable Edit: - now on desktop I have set the following paths: /public_html/index-waithere.php /public_html/app/ /public_html/system/ /public_html/writable/ Online Demo: https://ci4-strict.tk/index-waithere.php https://ci4-strict.tk/index-waithere.php...-the-paths Code: <?php DECLARE(STRICT_TYPES=1);
Thank you John_Betong!
All your post made me think about that simple mistake (but not soo clear before, considering previous errors). In my case, now it works like this: Just with these edits: Old: $pathsPath = FCPATH . '../app/Config/Paths.php'; New: $pathsPath = FCPATH . '../cgi-bin/app/Config/Paths.php'; And .htaccess removed (to avoid the 500 error). Now I'm just not sure about what issues could create the .htaccess removal, and how to debug it. If there's a chance. I tried to remove part of the file code, section to section, but it always return error 500, until I delete all the file content...
@Waithere,
> And .htaccess removed (to avoid the 500 error). The main purpose of the .htaccess file is to redirect every URL to the index.php file. Redirection requires the apache2 "mod_rewrite.c" module to be loaded. If it is not loaded then redirection and pretty URLs will not work. It will be necessary to call "index.php?routing-parameters". .htaccess file is also used to set the either "production", "development" or "test" modes. Once the Welcome_message page is rendered correctly then try to get logging to create the log file. Try and introduce PHP errors and see what effect they have on rendering pages and the log items. The log file can be safely deleted if there are too many entries. A new log file will be created with new errors, warnings or debug entries are raised. |
Welcome Guest, Not a member yet? Register Sign In |