phphostingflightphp

how to clone an opensource php REST API


I am trying to make use of the following php application: open source Cyanogenmod OTA Server Alternative - updated link -

i opened an account with a free php hosting service and copied the project files to public_html folder

when i request the site i get this error:

<br />
<b>Warning</b>: require(vendor/autoload.php): failed to open stream: No such file or directory in <b>/home/imamromh/public_html/index.php</b> on line <b>25</b>
<br />
<br />
<b>Warning</b>: require(vendor/autoload.php): failed to open stream: No such file or directory in <b>/home/imamromh/public_html/index.php</b> on line <b>25</b>
<br />
<br />
<b>Fatal error</b>: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home/imamromh/public_html/index.php</b> on line <b>25</b>
<br />


Solution

  • I think the link to the repo you shared is incorrect. But the error you are getting is a common issue.

    You need to use composer to set this up, but since you are using a free host like host-ed, I doubt you have access to command line.

    To understand what is happening here, the error you are getting is because you do not have the required libraries which are needed to run this. Composer helps in installing these libraries (vendor/autoload.php is a part of all this) I am not going into the details so that you don't get confused.

    So alternatively find a host which gives you access to command line. Use this to get 10$ on digitalocean, enough for 2 months of hosting. https://m.do.co/c/22764aaa6bbf

    Setup a LAMP server https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu

    simply execute the following instruction and your current problem will be solved.

    cd /var/www/ && composer create-project julianxhokaxhiu/cyanogenmod-ota CyanogenModOTA