CodeIgniter Forums
Hosting CI4 on World4You Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Hosting CI4 on World4You Problem (/showthread.php?tid=74983)



Hosting CI4 on World4You Problem - IVIike - 12-04-2019

Hello guys,

I have a (hopefully quick) question: Wink

Is it possible to host a CI4 installation on the World4You provider servers?
I'm not able to get it running because obviously CI4 needs to point into the "/public" but I cannot change this setting via my control panel...

Can I configure to have the public folder in root of the subfolder? Or does CI4 only work in the root of the web-home?

The answer of the W4Y support was to change the hosting to a vServer but this does cost more and is a new server which I dont want.

I hope you can help me.

Thanks and have a nice day


RE: Hosting CI4 on World4You Problem - John_Betong - 12-04-2019

(12-04-2019, 12:13 AM)IVIike Wrote: Hello guys,

I have a (hopefully quick) question: Wink

Is it possible to host a CI4 installation on the World4You provider servers?
I'm not able to get it running because obviously CI4 needs to point into the "/public" but I cannot change this setting via my control panel...

Can I configure to have the public folder in root of the subfolder? Or does CI4 only work in the root of the web-home?

The answer of the W4Y support was to change the hosting to a vServer but this does cost more and is a new server which I dont want.

I hope you can help me.

Thanks and have a nice day
Yes it is possible although not recommended.

Copy app, system and writeable paths into the same directory as the index.php file. Set the index.php $applicatio path to point to the app path then also set the app/Config.php baseurl and also set the paths in app/Paths.php.
Also make sure the, htaccess environment is set to development and don't forget to makes the writeable path writable.


RE: Hosting CI4 on World4You Problem - IVIike - 12-04-2019

Thank you for the information.
I changed as described but I only see a blank empty page - no errors or HTML code.

if I "vardump" $app in index.php i get the following output which is displayed:

object(CodeIgniter\CodeIgniter)#8 (12) { ["startTime":protected]=> float(1575458255.783) ["totalTime":protected]=> NULL ["config":protected]=> object(Config\App)#6 (29) { ["baseURL"]=> string(30) "https://www.grubaer-it.at/ci4/" ["indexPage"]=> string(9) "index.php" ["uriProtocol"]=> string(11) "REQUEST_URI" ["defaultLocale"]=> string(2) "en" ["negotiateLocale"]=> bool(false) ["supportedLocales"]=> array(1) { [0]=> string(2) "en" } ["appTimezone"]=> string(13) "Europe/Vienna" ["charset"]=> string(5) "UTF-8" ["forceGlobalSecureRequests"]=> bool(false) ["sessionDriver"]=> string(40) "CodeIgniter\Session\Handlers\FileHandler" ["sessionCookieName"]=> string(10) "ci_session" ["sessionExpiration"]=> int(7200) ["sessionSavePath"]=> string(52) "/home/.sites/41/site4229539/web/ci4/writable/session" ["sessionMatchIP"]=> bool(false) ["sessionTimeToUpdate"]=> int(300) ["sessionRegenerateDestroy"]=> bool(false) ["cookiePrefix"]=> string(0) "" ["cookieDomain"]=> string(0) "" ["cookiePath"]=> string(1) "/" ["cookieSecure"]=> bool(false) ["cookieHTTPOnly"]=> bool(false) ["proxyIPs"]=> string(0) "" ["CSRFTokenName"]=> string(14) "csrf_test_name" ["CSRFHeaderName"]=> string(12) "X-CSRF-TOKEN" ["CSRFCookieName"]=> string(16) "csrf_cookie_name" ["CSRFExpire"]=> int(7200) ["CSRFRegenerate"]=> bool(true) ["CSRFRedirect"]=> bool(true) ["CSPEnabled"]=> bool(false) } ["benchmark":protected]=> NULL ["request":protected]=> NULL ["response":protected]=> NULL ["router":protected]=> NULL ["controller":protected]=> NULL ["method":protected]=> NULL ["output":protected]=> NULL ["path":protected]=> NULL ["useSafeOutput":protected]=> bool(false) }


RE: Hosting CI4 on World4You Problem - InsiteFX - 12-04-2019

I run mine on my server just by changing public to public_html that's it.


RE: Hosting CI4 on World4You Problem - John_Betong - 12-04-2019

@InsiteFX

The way I understood @IVlike's question was the app, system and writable folders could not be saved above the public root folder and was only available in the more expensive vServer option.


RE: Hosting CI4 on World4You Problem - IVIike - 12-04-2019

I'v tried another free webhosting solution and this works without any problems just by moving the app/system/writeable paths and adapting the baseUrl parameter.

Then, I also tried to transfer this working setup to W4Y and changing the baseURL but it still gives me a blank page...
So I assume there is something wrong with Web-Hosting Settings of W4Y. If I get it to run I will post the solution but so far I did not manage to run it on a manages web host on W4Y.


RE: Hosting CI4 on World4You Problem - John_Betong - 12-05-2019

@IVlike
Try this because it adds line feeds and makes it easier to read.

echo '<pre>'; var_dump($app); echo '</pre>'; die;

Edit:
Pasted results should be in a code block otherwise results will lose linefeeds and wrap again Sad


RE: Hosting CI4 on World4You Problem - InsiteFX - 12-05-2019

Here is the code for a pretty var dump place in any helper and load it.

PHP Code:
// -----------------------------------------------------------------------

/**
 * varDebug () - Add this method to a CodeIgniter Helper.
 * -----------------------------------------------------------------------
 *
 * Formatted output of var_dump() etc;
 */
if ( ! function_exists('varDebug'))
{
    /**
     * Debug Helper
     * -------------------------------------------------------------------
     * Outputs the given variable(s) with color formatting and location
     *
     * @param    mixed    - variables to be output
     */
    function varDebug()
    {
        list($callee) = debug_backtrace();

        $arguments func_get_args();

        $totalArguments func_num_args();

        echo '<div><fieldset style="background: #fefefe !important; border:1px red solid; padding:15px">';
        echo '<legend style="background:lightgrey; padding:5px;">'.$callee['file'].' @line: '.$callee['line'].'</legend><pre><code>';

        $i 0;
        foreach ($arguments as $argument)
        {
            echo '<strong>Debug #'.++$i.' of '.$totalArguments.'</strong>: '.'<br>';
            
            
// this cam be changed to print_r() if you prefer that.
            var_dump($argument);
        }

        echo "</code></pre></fieldset><div><br>";

        exit;
    }


Gives a very nice output dump. easy to read.


RE: Hosting CI4 on World4You Problem - MGatner - 12-05-2019

CI4 includes Kint which has some handy and pretty output options. Try d($variable) or dd($variable), latter dumps and dies, both format for either CLI or web.

OP, it’s worth tracking down where the failure is actually happening. Try some dumps or breakpoints at various places in CodeIgniter.php and bootstrap.php and see if you can tell where it is failing


RE: Hosting CI4 on World4You Problem - John_Betong - 12-05-2019

@MGatner
> CI4 includes Kint which has some handy and pretty output options. Try d($variable) or dd($variable), latter dumps and dies, both format for either CLI or web.

I tried Kint and thought it was wonderful but went off it because w3.org validation tools fail miserably even for a simple "Hello world" web page.

I have a couple of small function which format any type of variable.

When trying to validate the page there are far too many Klint errors and warnings shown. Difficulty arises trying to find a single missing brackets or semi-colon amongst the hundreds of notifications!

On a dozen sites, with thousands of pages, I prefer being able to include a common PHP footer that generates links to the free HTML and CSS w3.org validation tools.

On my latest project, three Git commands, add, commit and post are used to update the Repository and hopefully soon to be combined to a single instruction. Also a single RSync one line script used to compare development and online project scripts. Zipped partial file contents are uploaded in seconds.

I think Kint is detrimental to developent - far better to have easily validated web pages and compatible tools!

my two Satangs Smile