# Api service is not working in live server

**URL:** <https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479>\
**Category:** Questions\
**Created:** [May 9, 2017, 7:58am UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479 "2017-05-09T07:58:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sure](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sure](https://discourse.slimframework.com/u/sure)\
**Post date:** [May 9, 2017, 7:58am UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/1 "2017-05-09T07:58:57Z")

</div>

I wrote a small api service using slim3 which working fine in my local environment but i when deploy to my live shared hosting server .

 ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/201c4c024dcaae9b53f972f0096958ea4baeed7c.png) ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/dbbc38010d5d97097efe03cda23131db39f05516.png) ![](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/836e8da867ea59c6426a3329b0b6f02651331d51.png)

i dont know how to config my .htaccess file and please some help me. Thanks in Advances .

---

<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:** [May 9, 2017, 10:42am UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/2 "2017-05-09T10:42:10Z")

</div>

I see your app in a directory called `root` on the right, and I see a `public_html` directory on the left. Typically what you would do would be to put the directory you are calling `root` into your home folder, then set your webserver to look into `~/root/public` instead of `~/public_html`.

Since you are on shared hosting you may or may not be able to do that. If not, you would put the folders within your local project into your home folder, renaming the `public` folder to `public_html`. That gets messy though as your `app`, `boot`, and `db` folders, etc will be alongside your `etc`, `mail` and `public_ftp` folders, etc.

---

<div class="post-metadata">

**Author:** ![damianopetrungaro](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/damianopetrungaro/32/236_2.png) [@damianopetrungaro](https://discourse.slimframework.com/u/damianopetrungaro)\
**Post date:** [May 9, 2017, 12:08pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/3 "2017-05-09T12:08:26Z")

</div>

As @tflight said, you need to map your “DirectoryRoot” parameter in apache configuration file (or “root” parameter in ngnix configuration file) to your public folder intead of public\_html.

---

<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:** [May 9, 2017, 12:16pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/4 "2017-05-09T12:16:47Z")

</div>

The `.htaccess` file in there makes it look like the server is Apache.

---

<div class="post-metadata">

**Author:** ![sure](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sure](https://discourse.slimframework.com/u/sure)\
**Post date:** [May 9, 2017, 1:17pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/5 "2017-05-09T13:17:23Z")

</div>

Thanks for your awesome reply … sorry for delay response … i am new to php and slim and i dont know how to set the webserver to look into ~/root/public instead of ~/public\_html. Please help how to do it…

---

<div class="post-metadata">

**Author:** ![sure](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sure](https://discourse.slimframework.com/u/sure)\
**Post date:** [May 9, 2017, 1:19pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/6 "2017-05-09T13:19:47Z")

</div>

thanks for your reply. But i am sorry that can’t understand what your are saying… sorry i am new php and slim…

---

<div class="post-metadata">

**Author:** ![sure](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sure](https://discourse.slimframework.com/u/sure)\
**Post date:** [May 9, 2017, 1:40pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/7 "2017-05-09T13:40:28Z")

</div>

I changed my folder structure like below.  
|-- Root  
----- |-- app  
----- |-- boot  
----- I-- db  
----- |-- public\_html

[09-May-2017 18:58:17 Asia/Kolkata] PHP Warning: require(/home/server\_name/public\_html/vpos/boot/…/vendor/autoload.php): failed to open stream: No such file or directory in /home/server\_name/public\_html/vpos/boot/app.php on line 3  
[09-May-2017 18:58:17 Asia/Kolkata] PHP Fatal error: require(): Failed opening required ‘/home/server\_name/public\_html/vpos/boot/…/vendor/autoload.php’ (include\_path=’.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php’) in /home/server\_name/public\_html/vpos/boot/app.php on line 3

The error\_log file indicates this error. I don’t know … what to do

---

<div class="post-metadata">

**Author:** ![sure](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sure](https://discourse.slimframework.com/u/sure)\
**Post date:** [May 9, 2017, 2:17pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/8 "2017-05-09T14:17:56Z")

</div>

@tflight @damianopetrungaro Thanks both of you … i fixed my issues … Thank you so mach … i follow your instructions to solve that issues. sorry for my poor communication… Thanks for onces again .

---

<div class="post-metadata">

**Author:** ![damianopetrungaro](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/damianopetrungaro/32/236_2.png) [@damianopetrungaro](https://discourse.slimframework.com/u/damianopetrungaro)\
**Post date:** [May 14, 2017, 5:23pm UTC](https://discourse.slimframework.com/t/api-service-is-not-working-in-live-server/1479/9 "2017-05-14T17:23:08Z")

</div>

@sure no problem 😃

You’re the welcome!
