Deploy slim project to webserver

Hello :slight_smile:

I finished a small slim project and want to upload it to my web server via filezilla.
So for every domain it creates a folder in my ‘www’ folder. Now I need to upload my website to this www subfolder.

The structure of my slim project ist as follow:
slim project structure

In the public folder is my index.php and .htaccess file.
index.php:
<?php

require __DIR__ . '/../vendor/autoload.php';

require __DIR__ . '/../bootstrap/app.php';

$app->run();

.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

The site shows an HTTP ERROR 500.

Can someone please help me?

Your server logs will give you further details about the 500 error. Without knowing about your environment, you need to figure out where the domain’s root is. For example without any Slim app, where would the index.html file go? What is the name of that folder? That is your web root folder.

Your index.php and .htaccess files that are in your public folder would go into that web root, and the other directories (like app, bootstrap, routes, etc) and files (composer.json, etc) would go alongside your web root folder.

So if your web root is named www you would have:

  • app/
  • bootstrap/
  • www/ (with your index.php and .htaccess)
  • routes/
  • vendor/
  • views/
  • composer.json
  • composer.lock

As @tflight said before, you can change your public/ path to www/ to be conform with your webhost, or you can keep the public/ directory by defining public/ as your web server’s document root. Most providers should be able to support these configuration settings.