Welcome Guest, Not a member yet? Register   Sign In
Installing on cPanel - is this right?
#1

Hi guys, having a terrible time trying to install Codeigniter on a subdomain for a development project, I have found the user guide very difficult to follow especially for when putting on shared hosting - so I have been trying to follow the guide provided here - https://forum.codeigniter.com/showthread.php?tid=76779
In public_html I have several subdomains, this one named wss, so in /home/account-name/ I created a directory called Codeigniter and put all files and directories in there (except Public) and in /home/accountname/public_html/wss/ I have put the files from within the public directory. I then put database details in /home/account-name/Codeigniter/app/config/Database.php and the web address for my subdomain in /home/account-name/Codeigniter/app/config/App.php
So far so good? Wrong! Internal server error - all of the files from inside the public directory have permissions 664 by default, I had to change index.php to 644 in order for it to load.
OK so going to the address for my subdomain now gives me the welcome screen, have I done the above correctly? Anything i've missed?
Now my project is going to have a user registration/login process etc.. and I saw in the user guide that there is a repo called shield? I got on to my Terminal, navigated to /home/account-name/Codeigniter/ and tried composer require codeigniter4/shield but got Could not find a version of package codeigniter4/shield matching your minimum-stability (stable). Had to add a few lines to Composer.json, run the command again and something happened - I assume this Shield repo is now in place? 
But now i'm stuck... Guide for Shield says to run php spark shieldConfusedetup which I have done, but I get:
Warning: chdir(): No such file or directory (errno 2) in /home/account-name/codeigniter/spark on line 56
CodeIgniter v4.2.10 Command Line Tool - Server Time: 2022-12-12 10:44:54 UTC-06:00
[CodeIgniter\Exceptions\FrameworkException]
Your zlib.output_compression ini directive is turned on. This will not work well with output buffers.
at APPPATH/Config/Events.php:28

(p.s. my zlib.output_compression is not turned on).

Any help appreciated, many thanks for your time.
Reply
#2

The way I do.

On CPanel create an FTP user for yourself, then I change to the root folder and upload my CodeIgniter
project to it using Filezilla FTP..

I did have a sub-domain once, and I did it the same way except I changed to the sub-domain folder first
then uploaded the project.

Now your host may be using public or public_html.

I always change my project to the public_html because thats what my host uses.

FileZilla - Client
Download the FileZilla Client one.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 12-13-2022, 04:05 AM by captain-sensible. Edit Reason: forgot to add some points )

i've found its best to get everthing set up with alll software on your own PC, zip everything and upload .

With composer and installing software into a web app , in my case on linux arch /srv/http/nameOfWebAppSubdirectory although the web app is located not in /home/$user but inside linux system composer is recommended to be used with "$" i.e not "#" root . See composer docs

I found if i used composer with root permissions , on my web dev context local host it didn't go well. On live i didn't like seeing "#" when logged in via putty
So didn't even try


I'm using sub domain for my webs.
i don't bother via a shell when i can have a nice Cpanel GUI .
First I add a domain via cpanel. That puts a directory with the name i want inside document root of live web hosting.

Then i go and create a public directory inside the subdomain directory. Next i go to subdomain icon on cPanel and edit document route for subdomain so its for example andrewbrookes.org/public


The structure of my CI4 live , inside the subdirectory is : app, public, vendor, writable

So everything INSIDE your public on localhost, has to go to inside of public on live; the rest has to go to inside of subdomain directory live.
Another way is to zip up public and upload to inside subdomain directory.

if you want to zip everything inside a directory say called misc from a terminal on linux command is :
Code:
//cd first inside of directory misc
[andrew@darkstar:~]$ cd Desktop/misc                                      (12-13 10:33)
[andrew@darkstar:Desktop/misc]$ zip -r  inside.zip  .      

//i give the files a name inside.zip  note trailing dash

if i upload inside.zip to public directory on live, there is no directory wrapping files , so on extract you will get files you want inside the already existing directory of public in subdomain


So the software installed is in the vendor directory , i've found that the paths via autoload (of composer) , that work on localhost, if zipped up correctly and uploaded are respected live.


directory permissions from mine live:
Code:
sub domain 0750
app,public,  vendor 0755
writable 0777

cache,session etc inside writable 0777

index.php inside public 0775
css, js directories 0775
robots.txt, sitemap.xml 0644


the first 7 , equates to read , write and execute. you may be wondering why "execute" is needed. The way things work the system will not have permission to enter the directory without that execute.
CMS CI4     I use Arch Linux by the way 

Reply




Theme © iAndrew 2016 - Forum software by © MyBB