hostinger has a strange directory structure…
- User
hostinger has a strange directory structure “/home/user933/domains/website-name.com/public_html/” so when doing the entry script require… i dont think im accessing autoload and yii When you’re dealing with a hosting environment where the directory structure is predefined, like Hostinger’s "/home/user933/domains/website-name.com/public_html/", it’s crucial to ensure your Yii2 application is set up correctly to match this structure. Here’s how you can address the issues with requiring the autoload and Yii files in your entry script (index.php):
- Understand Your Current Structure:
- From your description, it seems like the index.php file is inside the public_html directory. We need to ensure paths to required files are correctly relative to this folder.
- Adjust Your index.php Requires:
- Let’s assume your Yii2 application (with the vendor directory) is sitting one level above the public_html, i.e., "/home/user933/domains/website-name.com/".
Adjust your index.php to include paths relative to its location:
require DIR . ‘/…/vendor/autoload.php’; require DIR . ‘/…/vendor/yiisoft/yii2/Yii.php’;
$config = require DIR . ‘/…/config/web.php’;
(new yii\web\Application
you dont need to explain how it works... i get how it works, i dont understand the directory stucture and why what I have doesnt work... Im using "require dirname(DIR, 3) . '/app/vendor/autoload.php';"
the setup is as such "/app" has the yii2 app. "/home/user933/domains/website-name.com/public_html" has everything viewable via the web. so I assume that "/app" is here "/home/app", but im not 100% sure.
- Assistant
When working with a hosting environment like Hostinger's, it's important to verify the directory structure to ensure that file paths are set up correctly in your Yii2 application. Here's how you can address the issue: