Rectangle 27 3

I had the same problem. The thing is, you can not access stuff in storage so as it is suggested here you can simply make a symbolic link from public/storage to storage/app/public by using this command php artisan storage:link and then you can access whatever in storage directory through public directory like this asset('storage/path_to_file'), of course sometimes it is not possible for you to do so (for instance when you are deploying your project to a shared host). If this is the case, you can try uploading the files to public directory(which is accessible to everyone) and address the files using asset() method 1. you can simply define a new disk driver in disks array which exists in config/filesystems.php. in laravel 5.4, three drivers have been defined by default('local', 'public', 's3'). you just need to add your own driver which here we call it 'MyDiskDriver' (but you can call it whatever you want). config/filesystems.php

'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_KEY'),
            'secret' => env('AWS_SECRET'),
            'region' => env('AWS_REGION'),
            'bucket' => env('AWS_BUCKET'),
        ],
        'MyDiskDriver' => [
            'driver' => 'local',
            'root' => public_path('uploads'),
            'url' => env('APP_URL').'/public',
            'visibility' => 'public',
        ],

    ],
];

notice that for 'MyDiskDriver', 'root' has been set to public/uploads (which means when you use store method of Illuminate\Http\UploadedFile class and pass the name of the 'MyDiskDriver' as the second argument, laravel would upload the file in public/uploads directory.)

This is best answer. I have seen many solution including symbolic link solution as suggested on Laravel docs itself. But that create problem when moving from one server to other (Since you need to run the command again). Just create the new disk with public folder as root and you are done Great man

php - display image from storage laravel 5.3 - Stack Overflow

php laravel
Rectangle 27 1

The built in builder for all authentication routes is actually Auth::routes().

php - Laravel 5.3 route auth not working on shared hosting - Stack Ove...

php laravel laravel-5.3
Rectangle 27 2

Buddy just follow this tutorial, I tried it and it's working just fine!

Btw, you don't even need the last part after this sentence

If you dont have composer installed already on your server, you can easily grab it to the project directory then.

In my case I did the following: placing laravel project outside of public_html as lara folder

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^awesome
RewriteRule ^(.*)$ awesome/$1 [L]

Where awesome is the directory that contains htacess (listed down) and index.php, favicon and robots.txt:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylorotwell@gmail.com>
 */

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/

/* die(__DIR__);  /home/{YOURHOST}/public_html/awesome */
require __DIR__.'/../../lara/bootstrap/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/../../lara/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

How do I run the compser command? I dont have access to the server via ssh. Another thing. I did everything listed in the tutorial (as far as I could understand and still getting the error). However, I dont have a .htaccess file (I deleted it erroneously).

Upload your local version of .htaccess, and regarding the composer command you don't have to, the convention saying is: composer update should run on local only in this case only composer.lock is what going to be changed, in your case you have to upload the vendor folder too, don't ignore it :)

Thats the problem. I mistakenly deleted it (the .htaccess file). What do I do?

Ok, thanks. I think it's a .htaccess file problrmproblem too but I have no way to verify. I will have to find a way to get it

php - Laravel 5 shared hosting deployment issues - Stack Overflow

php apache .htaccess laravel laravel-5
Rectangle 27 0

It was pretty easy to get Laravel 4/5 running on OpenShift Online. For anyone else running into hosting issues, check out: https://hub.openshift.com/quickstarts/115-laravel-5-0

php - How to deploy laravel 4.2 on shared hosting? - Stack Overflow

php laravel-4 shared-hosting
Rectangle 27 0

There's a number of places where you can define your database connections. By default, you'll define them here:

app/config/database.php
app/config/local/database.php

Whenever I migrate a project to a live server, I add the following folder and files into Laravel:

app/config/production/app.php
app/config/production/database.php

The changes you make in this folder (including any database connections in database.php will be the settings used by Laravel when you're in your production environment. To check the current environment, use:

php artisan env
bootstrap/start.php
$env = $app->detectEnvironment(array(
  'local' => array('local_computer_name'),
  'production' => array('server_name') 
));

For example, my local Virtual Box has a name of timpc, so setting 'local' => array('timpc') would cause php artisan env to echo "Local".

Hopefully that helped, here's the TL:DR

  • Create a folder in app/config called production
  • Create the files app.php and database.php and modify them as needed for your production environment.
  • Make sure you have the setting in bootstrap/start.php that applies your server's name to the Production environment.

That should solve the issue you are facing. If not, there's is something else wrong. Quick questions, have you pushed the Laravel Project to HostGator using Git or something similar? I assume you have, and you're using HostGator's CLI to call php artisan migrate, but if not, that would be the issue.

php - Laravel Homestead: Migrations do not occur on shared host's data...

php database laravel-4
Rectangle 27 0

PHP 5.4 is available on shared hosting accounts provisioned after May 1, 2013 using by adding the following code to your .htaccess file.

AddType application/x-httpd-php54 .php

php - install laravel on hostgator shared hosting - Stack Overflow

php laravel laravel-4
Rectangle 27 0

I think it is quite clear what is going on. You set the routes for POST and GET, but expect DELETE and PUT to do the routing magically.

Route::delete('attributes/destroy/{id}','AttributesController@destroy');
Route::put('products/{id}', 'ProductsController@update');

With Route::resource(...) I set the routes for GET, POST, DELETE and PUT. With Route::resource I do not need to manually write Route::get ... etc. Moreover my routes are OK on local hosting!

php artisan routes

But have you tried it? From my experience with laravel, sometimes resource gets overwritten when you add a 'post' addition.

Route::resource('products', 'ProductsController');
MethodNotAllowedHttpException

And the other way around? With writing out all the possible methods without the resource? In laravel4 I deleted all the resources and that got me going.

php - Some of my Laravel routes (PUT and DELETE) doesn't work on a sha...

php laravel url-routing laravel-routing
Rectangle 27 0

A2 Hosting is a shared hosting platform that supports Laravel installed right out of the box. Click here to see their Laravel support.

Not the downvoter, but this reads like an advertisement, and the question is off-topic anyway. It is likely to be put on hold.

Yes, I didn't think you were actually spamming. But since the question is off-topic, it is often thought here that help is best kept to the comments section. It is one of the many Stack Overflow memes (there are a lot of them!).

php - Laravel - Shared hosting that supports Laravel - Stack Overflow

php laravel laravel-5 web-hosting
Rectangle 27 0

I had the same problem. The thing is, you can not access stuff in storage so as it is suggested here you can simply make a symbolic link from public/storage to storage/app/public by using this command php artisan storage:link and then you can access whatever in storage directory through public directory like this asset('storage/path_to_file'), of course sometimes it is not possible for you to do so (for instance when you are deploying your project to a shared host). If this is the case, you can try uploading the files to public directory(which is accessible to everyone) and address the files using asset() method 1. you can simply define a new disk driver in disks array which exists in config/filesystems.php. in laravel 5.4, three drivers have been defined by default('local', 'public', 's3'). you just need to add your own driver which here we call it 'MyDiskDriver' (but you can call it whatever you want). config/filesystems.php

'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_KEY'),
            'secret' => env('AWS_SECRET'),
            'region' => env('AWS_REGION'),
            'bucket' => env('AWS_BUCKET'),
        ],
        'MyDiskDriver' => [
            'driver' => 'local',
            'root' => public_path('uploads'),
            'url' => env('APP_URL').'/public',
            'visibility' => 'public',
        ],

    ],
];

notice that for 'MyDiskDriver', 'root' has been set to public/uploads (which means when you use store method of Illuminate\Http\UploadedFile class and pass the name of the 'MyDiskDriver' as the second argument, laravel would upload the file in public/uploads directory.)

Instead of doing step 2, you can change the value of FILESYSTEM_DRIVER environment variable in .env to the name of the disk driver that you have just created, In our case MyDiskDriver. This way you can easily change the disk driver without the need of changing your code, just by changing the FILESYSTEM_DRIVER environment variable's value

This is best answer. I have seen many solution including symbolic link solution as suggested on Laravel docs itself. But that create problem when moving from one server to other (Since you need to run the command again). Just create the new disk with public folder as root and you are done Great man

php - display image from storage laravel 5.3 - Stack Overflow

php laravel
Rectangle 27 0

../some_path/public_html/laravel_app/public

Is the whole project save in the public_html folder? Isn't the code vulnerable?

php - How to modify laravel file upload code to work on shared hosting...

php laravel file-upload hosting shared-hosting
Rectangle 27 0

Go to laravelFolder/bootstrap/cache then rename config.php to anything you want eg. config.php_old and reload your site. That should work like voodoo.

The one and only solution! If you wonder why works ? only god knows

Confirmed it wipe the pain in the a** while hosting laravel 5.4 from windows to shared hosting.... THANK YOU!!!

It seems that in a few scenarios, this is the only solution that works. If you have a cached config, and then you remove a Facade or Service Provider, when you run the command to create the new cached config, it runs using the existing cached config, and tries to reference the Facade and/or Service Provider classes that no longer exist and fails. The other option would be to remove the references from the config file, regenerate your cached config, then remove the actual Facade and/or Service Provider classes.

php - Laravel 5 - Clear cache in shared hosting server - Stack Overflo...

php laravel-5 command-line-interface
Rectangle 27 0

You can do this if you are using Lumen from Laravel on your routes/web.php file:

use Illuminate\Support\Facades\Artisan;

$app->get('/clear-cache', function () {
    $code = Artisan::call('cache:clear');
    return 'cache cleared';
});

php - Laravel 5 - Clear cache in shared hosting server - Stack Overflo...

php laravel-5 command-line-interface
Rectangle 27 0

There is now a command in Laravel 5.1 for that

php artisan view:clear

php - Laravel 5 - Clear cache in shared hosting server - Stack Overflo...

php laravel-5 command-line-interface
Rectangle 27 0

is it possible to use the code below with the new clear cache commands:

//Clear Cache facade value:
Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return '<h1>Cache facade value cleared</h1>';
});

//Reoptimized class loader:
Route::get('/optimize', function() {
    $exitCode = Artisan::call('optimize');
    return '<h1>Reoptimized class loader</h1>';
});

//Route cache:
Route::get('/route-cache', function() {
    $exitCode = Artisan::call('route:cache');
    return '<h1>Routes cached</h1>';
});

//Clear Route cache:
Route::get('/route-clear', function() {
    $exitCode = Artisan::call('route:clear');
    return '<h1>Route cache cleared</h1>';
});

//Clear View cache:
Route::get('/view-clear', function() {
    $exitCode = Artisan::call('view:clear');
    return '<h1>View cache cleared</h1>';
});

//Clear Config cache:
Route::get('/config-cache', function() {
    $exitCode = Artisan::call('config:cache');
    return '<h1>Clear Config cleared</h1>';
});

It's not necessary to give the possibility to clear the caches to everyone, especially in a production enviroment, so I suggest to comment that routes and, when it's needed, to de-comment the code and run the routes.

php - Laravel 5 - Clear cache in shared hosting server - Stack Overflo...

php laravel-5 command-line-interface
Rectangle 27 0

# change: 'public' => __DIR__.'/../public',
'public' => __DIR__.'/../../public_html',

I created a script to setup laravel projects for shared hosting environments. Here is the gist: https://gist.github.com/meganlkm/74dba6c4350ed58bf7bb

php - How to deploy laravel 4.2 on shared hosting? - Stack Overflow

php laravel-4 shared-hosting
Rectangle 27 0

You will not be able to get 4.2 to work on PHP 5.3 due to the use of traits and short array syntax.

Laravel 4.2 support for PHP 5.3 on shared hosting - Stack Overflow

php laravel laravel-4 shared-hosting
Rectangle 27 0

Your Storage directory doesn't have the right permissions on it. I know in Linux you have to do chmod -R 777 app/storage to allow access to it, so do the same to that directory on Windows.

This error isn't caused by any code in particular. When navigating to the URL of a Laravel application that doesn't have storage permissions set right, the application with die and give you that error. I don't know how you configure permissions on a windows machine (I develop on Linux) but I know you have to set app/storage/ to writable before you can 'run' the application.

php - issues deploying laravel 4 on windows shared hosting server - St...

php laravel
Rectangle 27 0

DirectoryIndex index.html index.php

This will make apache automatically find and render index.html if found otherwise index.php will be shown in any sub-directory under DOCUMENT_ROOT.

php - Mod_Rewrite issue on shared hosting (Godaddy & Laravel 4) - Stac...

php apache mod-rewrite laravel
Rectangle 27 0

php-cli artisan list

If it will not be working you should probably contact bluehost support it is about server settings.

php - Cannot execute Laravel Artisan commands on shared hosting - Stac...

php shell laravel hosting bluehost
Rectangle 27 0

You can call an Artisan command outside the CLI.

Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    // return what you want
});

There is no way to delete the view cache. Neither php artisan cache:cleardoes that.

If you really want to clear the view cache, I think you have to write your own artisan command and call it as I said before, or entirely skip the artisan path and clear the view cache in some class that you call from a controller or a route.

But, my real question is do you really need to clear the view cache? In a project I'm working on now, I have almost 100 cached views and they weight less then 1 Mb, while my vendor directory is > 40 Mb. I don't think view cache is a real bottleneck in disk usage and never had a real need to clear it.

As for the application cache, it is stored in the storage/framework/cache directory, but only if you configured the file driver in config/cache.php. You can choose many different drivers, such as Redis or Memcached, to improve performances over a file-based cache.

What cache are you trying to clear? The cache:clear command works with the application cache, the one that is accessed from the Cache facade.

I want to clear the view cache, there are a lot of pages saved in view cache folder. One more question, when says application cache, which are all the directories it targets.

Thanks for the explanation!. I am not worried bout disks space :) But one question if view cache is not clearing, then how the new changes in view get affect in the website, is that any I/O check happening in laravel ?

I think it does a timestamp checking on files, which is faster than rebuilding the blade template

php - Laravel 5 - Clear cache in shared hosting server - Stack Overflo...

php laravel-5 command-line-interface