如何在 Hostinger 上部署自定义 PHP MVC 网站

发布于 2025-01-11 21:03:11 字数 1133 浏览 0 评论 0原文

这是我第一次部署实际的网站,并且使用自定义 MVC 架构完成了一个项目。在本地一切正常,但是当我将文件添加到 Hostinger 时,除了空白页面之外什么也没有出现。不过,图标和 CSS 仍然加载在 中。我的层次结构如下所示:

config
- index.php
public
- assets
- .htaccess
- index.php
- logout.php
src
- model
- view 
- controller
templates
- (list of all the things I render with my views)

在位于 config 文件夹中的 index.php 中,我拥有所有常量。看起来是这样的:

<?php
// HOST
define("HOST", "https://heptagone-art.com/public/");

// DIR
define("DIR_ASSETS", HOST . "assets/");
define("DIR_CSS", DIR_ASSETS . "css/main.css");
define("DIR_JS", DIR_ASSETS . "js/");

define('DIR_APPLICATION', '../src/');
define('DIR_MODEL', DIR_APPLICATION . 'model/');
define('DIR_VIEW', DIR_APPLICATION . 'view/');
define('DIR_CONTROLLER', DIR_APPLICATION . 'controller/');

define('DIR_TEMPLATE', '../templates/');

// DB
define("DB_HOSTNAME", "localhost");
define("DB_USERNAME", "(the username hostinger gave me");
define("DB_PASSWORD", "(the password I added on hostinger)");
define("DB_DATABASE", "(the database I added on hostinger");
define("DB_PORT", "3306");

我真的不知道如何正确部署整个事情,而且我不知道如何搜索它,因为我找到的信息与我所做的不匹配。

This is the first time I'm deploying an actual website and I did a project using a custom MVC architecture. Everything is working just fine on local but when I add my files to Hostinger, nothing appears but a blank page. The favicon and the CSS is still loaded in the , though. My hierarchy looks like that:

config
- index.php
public
- assets
- .htaccess
- index.php
- logout.php
src
- model
- view 
- controller
templates
- (list of all the things I render with my views)

In the index.php located in the config folder, I have all my constants. It looks like that :

<?php
// HOST
define("HOST", "https://heptagone-art.com/public/");

// DIR
define("DIR_ASSETS", HOST . "assets/");
define("DIR_CSS", DIR_ASSETS . "css/main.css");
define("DIR_JS", DIR_ASSETS . "js/");

define('DIR_APPLICATION', '../src/');
define('DIR_MODEL', DIR_APPLICATION . 'model/');
define('DIR_VIEW', DIR_APPLICATION . 'view/');
define('DIR_CONTROLLER', DIR_APPLICATION . 'controller/');

define('DIR_TEMPLATE', '../templates/');

// DB
define("DB_HOSTNAME", "localhost");
define("DB_USERNAME", "(the username hostinger gave me");
define("DB_PASSWORD", "(the password I added on hostinger)");
define("DB_DATABASE", "(the database I added on hostinger");
define("DB_PORT", "3306");

I don't really know how to deploy the whole thing properly, and I don't know how to search about it as the information I find don't match with what I did.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文