# First project, Problems to use the slim skeleton \[SOLVED\]

**URL:** <https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056>\
**Category:** Questions\
**Created:** [November 30, 2017, 1:00am UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056 "2017-11-30T01:00:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![getjv](https://avatars.discourse-cdn.com/v4/letter/g/7c8e57/32.png) [@getjv](https://discourse.slimframework.com/u/getjv)\
**Post date:** [November 30, 2017, 1:00am UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/1 "2017-11-30T01:00:57Z")

</div>

Hello guys!

Its is a basic thing but i’m in trouble to start my slim-path. so i will really appreciate your help.

As [the main slim tutorial](https://www.slimframework.com/) ask, i used the composer to get the slim-skeleton project into my www apache folder:

![diretorio](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/1c5957639f65e2c48509058191303117db4a0bb0.png)

but instead of the embedded php web server i’m using the apache2 web server.

here is my apache config sites-avaliable:  
 ![vw](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/551775abeafe3817b7300420f0d74db48573a44b.png)

and apache2.conf

 ![rw](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/b7c1670f745cd2189119995786a2a633a3f02669.png)

so , when i go to browser: at: localhost/saa  
 ![aa](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/20b19aa07a4f1ebb49c02d5d9ab1b933ea6ca96e.png)

if i go to “public” folder i get this result: HTTP ERROR 500.

i have tried to change the DocumentRoot to “/var/www/html/saa/public”

but after restart apache i got the same result: HTTP ERROR 500.

seems like a rewriter rule or redirect error, but i have no idea to solve this.

Can anyone help me to fix this and return my focus to learn the slim?

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [November 30, 2017, 11:51am UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/2 "2017-11-30T11:51:35Z")

</div>

I have a very simple fix for you to get Slim 3 running in a subdirectory:

Create a new file: `/var/www/html/saa/.htaccess`

Content of .htaccess

```auto
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]

```

In your dependencies.php or wherever you add your Service Factories:

```php
<?php

// ....

$container['environment'] = function () {
    $scriptName = $_SERVER['SCRIPT_NAME'];
    $_SERVER['REAL_SCRIPT_NAME'] = $scriptName;
    $_SERVER['SCRIPT_NAME'] = dirname(dirname($scriptName)) . '/' . basename($scriptName);
    return new Slim\Http\Environment($_SERVER);
};

// ...

```

Now you can open the app via: `http://localhost/slim3-app`.

---

<div class="post-metadata">

**Author:** ![getjv](https://avatars.discourse-cdn.com/v4/letter/g/7c8e57/32.png) [@getjv](https://discourse.slimframework.com/u/getjv)\
**Post date:** [December 1, 2017, 8:04pm UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/3 "2017-12-01T20:04:59Z")

</div>

Hi odan, thanks for you help. but didn’t work to me…

I have followed this steps:

1. Install the slim-skeleton by composer (composer.phar create-project slim/slim-skeleton slim3-app ) inside of “/var/www/html”  
2 - Created a .htaccess inside the slim3-app/.htaccess  
3 - edit the “slim3-app/src/dependencies.php” and add your snippet of code.  
4 - My documentRoot it’s mapped to: “/var/www/html”  
5 - i added th code in my git : [https://github.com/getJv/slim3-app](https://github.com/getJv/slim3-app)

So when i access " [http://localhost:8888/slim3-app."](http://localhost:8888/slim3-app.%22)

I received this error:

 ![111](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/6f18cd521bf9261bc8757d43f7aa1dda3035fff0.png)

I don’t know what it is happens… it is really complex to me use the slim3-skeleton project.

Any ideas?

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [December 2, 2017, 1:08pm UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/4 "2017-12-02T13:08:34Z")

</div>

Your documentroot should be mapped to `/var/www/html/slim3-app/public`, since that is where you installed it. The `.htaccess` would therefore be at `/var/www/html/slim3-app/public/.htaccess`. Then you would access it from `http://localhost:8888`. If you still get an error, look inside Apache’s error log to find the specific error. The one you see on the page is generic. Apache’s error log will give you more precise details as to what is going wrong.

---

<div class="post-metadata">

**Author:** ![getjv](https://avatars.discourse-cdn.com/v4/letter/g/7c8e57/32.png) [@getjv](https://discourse.slimframework.com/u/getjv)\
**Post date:** [December 2, 2017, 3:25pm UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/5 "2017-12-02T15:25:48Z")

</div>

Hi @tflight i’ve made your rocommend modifications.

1. Now my my documentRoot is its mapped to “/var/www/html/slim3-app/public”,  
 ![11](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/e0ea4174cd330d889aa72a574b3b34e38bd426b4.png)

2. So when o use the browser (localhost:8888) the error 500 persists.

3. **The apache error.log show the following error:**  
`[Sat Dec 02 14:46:49.400920 2017] [:error] [pid 407] [client 172.17.0.1:48502] PHP Fatal error: require(): Failed opening required '/var/www/html/slim3-app/public/../vendor/autoload.php' include_path='.:/usr/share/php') in /var/www/html/slim3-app/public/index.php on line 12`

4. the index.php on line 12 its looking a vendor directory… but there is no “vendor/” inside the slim-skeleton project  
 ![11](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/7b52c17c34f42b6a4a111b57d2e95d02e7926429.png)

5. My folders structure (slim-skeleton from composer command)  
 ![11](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/c2205b0690517331c3b715e9182c4ab7898fa5d4.png)

What do you think about? Am i doing something wrong or there is some possibility of the slim-skeleton it is out of date and is missing the “vendor” directory?

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [December 2, 2017, 3:32pm UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/6 "2017-12-02T15:32:05Z")

</div>

If you followed the instructions you should have that directory.

`cd` into your project directory and run `composer install`.

---

<div class="post-metadata">

**Author:** ![getjv](https://avatars.discourse-cdn.com/v4/letter/g/7c8e57/32.png) [@getjv](https://discourse.slimframework.com/u/getjv)\
**Post date:** [December 2, 2017, 5:24pm UTC](https://discourse.slimframework.com/t/first-project-problems-to-use-the-slim-skeleton-solved/2056/7 "2017-12-02T17:24:01Z")

</div>

> [@tflight](#):
>
> run composer install.

hahaha! it working!!! oh man really thanks for your help. after run the comporser install i saw that was missing some importants php modules, and for this reason the verdor folder and other slim things was missing.

but now it is everything working. Now i will go on with my studies.

Tranks bro!

 ![11](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/d56cc5e6898bc976265bf16e9251dfd2d268c5e9.png)
