Welcome Guest, Not a member yet? Register   Sign In
Access Forbidden to Public on shared hosting
#1

First time using.  Tried to install on shared hosting account and getting error "Access Forbidden You don't have permission to access the requested directory. There is either no index document or the directory is read-protected." Error 403

In the Cpanel i set up the root to redirect to mainsite/public.    so going to the mainsite redirects to the public subdir.  Is this the right way to do that, as I don't see in the CPanel how else to redirect the root to be public.  
If i rename (disable) the .htaccess file that's in Public,   I get the CI4 welcome screen.    But, am not able to get the example  Pages  to work.  

With the .htaccess enabled the site's Error Log says:

[Fri Jun 19 00:29:01 2020] [error] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /services/users/zstorage6p1/shyam/www/jacksonville-shuttersblindsandmore.com/public/

I have contacted the hosting admin and he said that for security reasons they won't enable SymLinks.  So, does that mean that CI4 will not work on this hosting account?    They offer an auto install for CI3,  but,   if i am going to learn and use a Framework (this is my first attempt at it), i might as well go with the current version.  

BTW, I originally tried to set up and use Laravel, but, gave up because of setup issues...   Basically the hosting site recommended we get a KVM site.   Right now, I just want to make a test program  web app   of what i want and am trying to work with what i've got.  I've been with this hosting company and had this account for over 15 years and have created a 3D interactive site using three.js.  And We've got WP sites, and a commerce site,   so far everything has been fine,     but having a hard time with FrameWork installs.
Reply
#2

Hi, that's not a recommended practice. I have just now created a thread about how to install it in cPanel:
Install CodeIgniter 4 on Shared Hosting

It's based on a post I made earlier, but as it's quite hard to find, I made a separate thread and put some glue on it.
Reply
#3

Thanks for the help, but, my hosting account is using a modified cpanel. 
Their support told me that rather than /home/public_html/sitename.com
their structure is    /home/www/sitename.com
But, the main problem is, i don't have permission to create directories in the /home directory.    I can create other directories in the www directory, but, obviously can't be of the same name as the sitename as that is also located there.  

So, any other options?   Or, again, am i missing something?
Reply
#4

If you can create folders in /home/www it's all good. Just name it sitename.com.app or whatever, as long as you know that you have your application in there.

So instead of

/example.com
/public_html

You will have

/home/www/sitename.com (index.php)
/home/www/sitename.com.app (app, system ...)
Reply
#5

Jreklund
Thanks for the help,  But...   I still can't get it installed.  
I was busy with other things, so didn't get back to right away.  T
hat, plus my site seems to cache the redirects.  The control panel has a redirect feature which creates a .htacl file, rather than a .htaccess file. Even after I use the Control Panel to delete the redirect and the .htacl file is gone,  the redirect remains, and i do page refresh without cache.  
Finally, today i wound up creating a new sub.domain and installed in there - finally no more redirect.   

The problem is our hosting account has symlinking disabled,  so all i get is:

Forbidden

You don't have permission to access this resource.AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions 

If I rename the .htaccess file (no.htaccess), then i get to the CI4 welcome page.  I haven't tried to set up the example test build yet, because i am not certain it will work without the redirects (?).

Is there another step i need to take?  
If i can't get this up and running soon, i will just code the app directly in php...   but, it is complex enough to warrant some sort of framework.
Reply
#6

BTW - without the .htaccess  - i built the sample  Pages  page,  in the users guide,   and all i get is:

(I entered   sub.domain.com/pages)

Not Found
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Which is what i thought would happen
Reply
#7

(This post was last modified: 06-21-2020, 02:00 PM by jreklund.)

Most likely a browser cache, run it in incognito.

I haven't tried to run CI4 without FollowSymlinks enabled, you can try to just comment that part out of the .htaccess file. Don't know what part of CI that actually needs that setting. There are no symbolic link in the application itself, to my knowledge. May be used by the tests.

If mod_rewrite requires it, then you need to access your urls with:
sub.domain.com/index.php/pages
Reply
#8

Sort of getting there,   maybe... 

mydomain.com   takes me to the CI4 welcome
mydomain.com/pages  gives  404 file not found
mydomain.com/index.php/pages     takes me to the CI4 welcome
mydomain.com/index.php/pages/index    takes me to CI4 welcome
mydomain.com/index.php/home  takes me to CI4 welcom
mydomain.com/index.php/pages/view      (or pages/view/home    or pages/view/about)
gives:

CodeIgniter\View\Exceptions\ViewException
Invalid file: templates/header.php
SYSTEMPATH/Exceptions/FrameworkException.php at line 17



i checked and the file    Views/templates/header.php   is there,   and is the html file header code as per the guide example
Reply
#9

You will need a working .htaccess configuration to get those 404 to work. Did you just remove FollowSymlinks? Or did you delete the whole thing?

And for the last error, your other pages should not have worked if it where a framework error, so either it's in the wrong place, wrong name or you typed it wrong from the documentation.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB