How to host laravel4 based app on a shared hosting - php

I have read lots of tutorial on hosting laravel 4 based app on shared hosting .But I am not able to deploy it successfully . I am getting following error
Warning: require(__DIR__/../bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in D:\Hosting\10588605\html\healthscape\ideconnect\public\index.php on line 41
Fatal error: require() [function.require]: Failed opening required '__DIR__/../bootstrap/autoload.php' (include_path='.;C:\php5\pear') in D:\Hosting\10588605\html\healthscape\ideconnect\public\index.php on line 41
I have website in which I want to deploy my app . For example I have this website .
http://healthscapeseries.com
I want to add my laravel app to this like
http://healthscapeseries.com/myappname/public/
it should point to my app. Can any one help me out with this .
Thanks in advance

It will be better if you point to your app like
http://healthscapeseries.com/myappname
For attaining this do following steps
Create a folder myappnamebase in your document folder
Put all your contents of the application except the public folder content to myappnamebase folder
Create new folder in public_html named myappname
Put all your public folder content in myappname folder
Then bring the following changes:
Inside public_html->myappname->index.php
instead of
require __DIR__.'/../bootstrap/autoload.php';
add
require __DIR__.'/../../myappnamebase/bootstrap/autoload.php';
instead of
$app = require_once __DIR__.'/../bootstrap/start.php';
add
$app = require_once __DIR__.'/../../myappnamebase/bootstrap/start.php';
Inside myappnamebase->bootstrap->paths.php do editting so that it looks like following
'app' => __DIR__.'/../../myappnamebase/app',
'public' => __DIR__.'/../../public_html/myappname',
'base' => __DIR__.'/../../myappnamebase',
'storage' => __DIR__.'/../../myappnamebase/app/storage',

Related

PHP works on localhost, error on Google Cloud server

I have a PHP that runs fine on localhost but throws error on the cloud server. On the localhost, the script runs and also fetched the data from datastore.
This is the line thats causing the problem:
require __DIR__ . '/../../vendor/autoload.php';
// this is the line5 of datastore.php
I deploy it using this code:
gcloud app deploy --promote --stop-previous-version app.yaml
After deploying to the Google AppEngine, i get this:
Warning:
require(/base/data/home/apps/myproject/projectID/dialpad_research/api/../../vendor/autoload.php):
failed to open stream: No such file or directory in
/base/data/home/apps/myproject/projectID/dialpad_research/api/datastore.php
on line 5 Fatal error: require(): Failed opening required
'/base/data/home/apps/myproject/projectID/dialpad_research/api/../../vendor/autoload.php'
(include_path='.;/base/data/home/apps/myproject/projectID/;/base/alloc/tmpfs/dynamic_runtimes/php55_dynamic/ef537742f8701211/sdk')
in
/base/data/home/apps/myproject/projectID/dialpad_research/api/datastore.php
on line 5
This file is required inside another PHP file too.
But even if I try to access this file directly, I still get the same error.
Should I be adding the require code differently?
The problem was that the vendor folder was not getting uploaded.
.gcloudignore file was preventing it.
After correcting it, this error is gone.
Thanks everyone from trying.
Your require code should look like this. Your vendor folder should normally be at root directory level of your code on the same level as your app.yaml. In which case, your require should look like this:
require 'vendor/autoload.php';
Also, sanity check and make sure the file is actually there in the vendor folder.

How to open stream with composer/ any other library

I've been trying to find the solution to my problem for DAYS. I couldn't find anyone to simply explain what to do to open stream with composer/any other library. It seems this is so simple, everyone knows how to do it.
my index.php
<?php
require 'vendor/autoload.php';
?>
error message:
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /home/(webhostusername)/(subdomain.mydomain)/index.php on line 3
Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/(webhostusername)/(subdomain.mydomain.com)/index.php on line 3
What else should I do? Do the composer files need to be in the same folder as my subdomain?
more information:
using Dreamhost shared hosting
installed composer via SSH
I want to use a library (raiym/instagram-php-scraper)
It is recommended to give a full path to the file you are trying to include.
require __DIR__ . '/vendor/autoload.php';
But you most definitely are trying to include a file that doesn't exist. Is the index.php file in a different directory than the vendor directory?

Moving yii project to another machine

I have a project, build in Yii Framework , in my machine 1.
Now I moved my whole project to new laptop.
But it's not running and displaying some error:
Warning: require_once(D:\xampp\htdocs\rpadmin/../framework/yii.php): failed to open stream: No such file or directory in D:\xampp\htdocs\rpadmin\index.php on line 11
Fatal error: require_once(): Failed opening required 'D:\xampp\htdocs\rpadmin/../framework/yii.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\rpadmin\index.php on line 11
Does anyone know what is happening?
You need to edit in your project the file index.php and change the line:
// change the following paths if necessary
$yii=dirname(__FILE__).'/../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
with your Yii Framework path location.
If you have framework folder in the same location with the project, you need to change like this:
$yii=dirname(__FILE__).'/framework/yii.php';
actually u have folder of yii(framework named folder) framework outside the rpadmin folder now u have to upload it from your local machine to the server and put it outside the rpadmin from... the error message ...
Warning: require_once(D:\xampp\htdocs\rpadmin/../framework/yii.php):
so there will be a framework named folder....
after that make some changes
Give rpadmin/protected/runtime permission 777
If its ISS the you have to give rpadmin/assets folder permission 777
change the required settings in rpadmin/protected/config/main.php if theres only like db connection

Laravel 4 bootstrap/autoload.php failed to open stream

When I uploaded my Laravel 4 application on a live web server I get the following error when going to the base URL:
Warning: require(/home/pvanmoll/domains/iheal.be/public_html/../laravel/bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home/pvanmoll/domains/iheal.be/public_html/index.php on line 21
Fatal error: require() [function.require]: Failed opening required '/home/pvanmoll/domains/iheal.be/public_html/../laravel/bootstrap/autoload.php' (include_path='.:/usr/local/lib/php') in /home/pvanmoll/domains/iheal.be/public_html/index.php on line 21
I have put my laravel-files in a separate folder next to public_html. In public html I put the content of laravel's public folder.
This is my data structure:
laravel
/app
/bootstrap
/vendor
...
public_html
/css
/js
index.php
...
In index.php I specified following lines:
require __DIR__.'/../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/start.php';
and in laravel/bootstrap/paths.php:
'public' => __DIR__.'/../../public_html',
On localhost everything runs fine, but when I upload it to my live web server, it won't work. I've been searching for days now and nothing can help me. Weird thing is that the two dots for going down a folder, won't work as they are just appended to my url instead of going down a folder.
Maybe it's because my web server is running on Php 5.3.27?
You need at least PHP >= 5.3.7 with L4. And why don't you change the web root on the server instead? Is it shared hosting?
You could also put all laravel install inside public_html, update bootstrap/path.php and index.php and redirect to laravel public with a htaccess. But this is definitely not recommended !

zend and smarty site clone problem

I created a site a while ago using zend and smarty. The site is hosted on a virtual machine with centOS. Now I want to create a similar site so I creeated another virtual host, ftp user etc etc on the same machine.
I modified the ini file that contained the paths:
paths.base = /var/www/html/new_path
paths.data = /var/www/html/new_path/data
paths.templates = /var/www/html/new_path/templates
paths.cache = /var/www/html/new_path/data/tmp/cache
paths.public = /var/www/html/new_path/public_html
The porblem is that somehow when I try to access zend/loader.php (I try to load a database object) it is used the loader from the old path (/var/www/html/oldpath/include/zend/loader.php) so naturally I cant access any new objects I create for the new site
(
Warning: include_once(DatabaseObject/New.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/html/old_path/include/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'DatabaseObject/New.php' for inclusion (include_path='.:/var/www/html/old_path/include:/usr/share/pear/') in /var/www/html/old_path/include/Zend/Loader.php on line 146
Fatal error: Class 'DatabaseObject_Chat' not found in /var/www/html/new_path/include/Controllers/ChatController.php on line 8
).
There are no other paths defined anywhere.
Caching is disabled.
It occurs on different computers, browsers, etc so is not a local problem (residual value of some-type).
For any details just ask... I'm stuck.
Zend_Loader looks into include directories defined in your public/index.php. The include path must be set properly to contain both the old directories and the new ones. Note the respective order specified by your include path.
The code in public/index.php should look similar to the following, assuming the use of ZF1:
<?php
...
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../project_name/path_for_inclusion'),
get_include_path(),
)));
...
The include path can be also adjusted in your .htaccess:
php_value include_path "/var/www/path:/var/www/second_path:/var/www/third"
or you can achieve the effect in general without ZF-specific code:
set_include_path(get_include_path() . PATH_SEPARATOR . $path_to_add);

Categories