Api service is not working in live server


#1

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 .

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


#2

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.


#3

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.


#4

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


#5

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…


#6

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


#7

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


#8

@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 .


#9

@sure no problem :smiley:

You’re the welcome!