Confused.
https://www.codeigniter.com/user_guide/general/caching.html
says caches are created in application/cache.
But, in the system config.php it says the default cache is in system/cache/.
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash.
|
*/
Which, if any, does CI use?
application/cache is correct. It was changed to application/cache from system/cache in 2.0.0 according to the change log. The comments just weren't updated.
Related
As this question has been asked soo many time and the solution is clear, but my problem is I have done every possible solution but it still doesn't solve my error.
I have all the required folders
-storage
-app
-framework
-cache
-session
-testing
-views
-logs
and also all the ".gitignore" files as well
also have run permission command
Below is my config/view.php
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('/storage/framework/views'))
),
];
My set up in localhost works well. I want to upload my Laravel app to my GoDaddy server. I created an FTP to transfer my Laravel app to my GoDaddy server. As what I've noticed upon creating my FTP account the files is inside /webroot so I created a /webroot/testapp inside testapp is my Laravel app. Inside Laravel app, there is a public folder. As what I've research in google other says only inside the public folder must be inside /public_html and Laravel app will be outside. in my case, it is /webroot. Now upon transferring my Laravel app to my server, I did not separate my public folder. I put it also in testapp folder because when I put the public folder outside my testapp folder and edit the index.php file my main site is in WordPress and it will cause an error. So I added the public folder into my testapp folder. When I tried to run in the browser it says 404 (Page Not Found) Error` so I tried to edit my index.php file below
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylor#laravel.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 great to relax.
|
*/
require __DIR__.'/../testapp/public/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__.'/../testapp/public/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);
Now can someone help me to work this thing out? I've seen it other tutorials is working well mine is not. Any help is muchly appreciated. TIA
You should upload the whole project from localhost to godaddy and then ask from the support team to edit your hosts pointing to public folder.
This is a shared hosting service , so you can't do it alone. Ask it.
Crete .htaccess in root directory and add this below code:-
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
Hope it helps!
Follow this tutorial it works for any shared hosting plan.
How can a host a Laravel 5.6 app to cpanel on a shared hosting.
Can someone give me an idea
require __DIR__.'/../vendor/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__.'/../bootstrap/app.php';
/*
\#########my index.php file
You have two methods available, one requiring ssh access. Under no circumstances do you put your entire Laravel directory into the public_html directory.
SSH Access
If you have SSH access you'll want to do the following;
Log into your account and go to your home directory cd ~
Delete the public_html directory
Now you want to upload your Laravel app to ~/laravel
Now you need to recreate public_html as a symlink cd ~ && ln -s laravel/public public_html
No SSH Access
If you don't have SSH access you'll want to do the following;
Upload your laravel installation to somewhere like ~/laravel (above the public_html)
Copy the contents of the ~/laravel/public directory to public_html
Change the path to match your new destination
Your new ~/public_html/index.php should look like the following;
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylor#laravel.com>
*/
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| 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 great to relax.
|
*/
require __DIR__.'/../laravel/vendor/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__.'/../laravel/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);
after googling around i found that you have to take content of public folder which has index.php file and put it in public_html. now we have to change the content of index.php file i.e just provide the right link of app.php and autoload.php which would be require __DIR__.'/<project_folder_name>/vendor/autoload.php' and $app = require_once __DIR__.'/<project_folder_name>/bootstrap/app.php'; also update your .env file and check it should work if it doesnt you have to clear cache and routes using php artisan cache:clear and php artisan route:clear you can do this using ssh or define the function in web.php and then hitting the link
An easy way if your shared hosting team is very supportive for you,
Upload your files to public_html folder, and then incase if you donot have ssh access to server, contact your hosting team and ask them to point your domain name to public_html/public folder as root folder.
And then ask them to execute following command via ssh
composer install
If you want to boost the peformance, please provide them the four commands listed in the following article.
https://www.techalyst.com/links/read/112/boosting-laravel-performance-in-production-server
Laravel 5.6 requires PHP 7.
First check your shared hosting support PHP 7 in Cpanel (PHP Selector), if yes but you have other projects which PHP 5 and you don't want to change default php version, then use this in .htaccess file
For example: public_html/abc/.htaccess
RewriteEngine on
AddHandler application/x-httpd-php71 .php
Then PHP 7 Work and you can work with Laravel 5.6 on shared hosting
laravel -> all laravel file
public_html -> move all folder & file on *public* file laravel to *public_html*
change your index.php on public html
require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
don't forget to change your php version to 7.2
The simplest way to host on shared hosting
Create a subdomain on hosting and map it to a folder e.g: "abc"
In folder "abc" upload laravel project zip (with vendor folder) then extract it
Map subdomain to the public folder of laravel i.e. "abc/public".
Create a database & user and assign that user to the database with all privileges
Import the DB dump in the database created above.
Add DB user/password in laravel .env file.
Note: If you face any due to cache remove file config.php in directory bootstrap/cache.
Umm. Shared hosting does NOT support php 7, which larave 5.6 depends on. Have you guys found a workaround. I have been stuck for months with laravel 4.x on bluehost.
Before you assume, I did read ALL other posts on this problem and I was unable to find a solution to my problem.
So the thing is, however and wherever i upload my files and folders on my web host i get the same result giving me the "currently unable to handle this request. HTTP ERROR 500". I'm using the 000webhostapp.
So I uploaded the project in my root directory "/", content of the public to the public_html project, and it gave me the text above. Then I tried moving my whole project into the public_html(public was its own directory inside public_html) and it gave me the same result. I've tried some solutions with .htaccess file but whatever I tried won't make it work. In my localhost project is installed somewhat like this "htdocs/kola/..", but on the web hosting it is just in the root, no other dir(that's something I think might help but I'm unable to use). So after 30 hours of trying and reuploading the project 5 times, still can't make it work and I'd be rather grateful if someone could even try to help me with this.
Thanks in advance
The right way is to get to the root of your folder ... ie /home/ and create a folder for your project. Then move the all the contents of your project into this folder except the public folder. Now go to the public_html folder and add all the contents of the public folder there.
Update your index.php as below:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylor#laravel.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 great to relax.
|
*/
require __DIR__.'/../(name of your root folder)/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__.'/../(name of your root folder)/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);
Configure the .env file and have the right database configuration.
Need not to create new dir. Just delete the content of index.php file and paste the above code and replace your (name of your root folder) with public_html.
im trying to install Laravel in my shared hosting website's(which is not laravel) subfolder.
for example in: example.com/dev
Structure:
->laravel
->app
->bootstrap
->public_html
...example.com folders & files
->dev
->css
->js
->.htacess
->index.php
... other Laravel public files
My example.com/dev/index.php looks like this:
... laravel codes
/*
|--------------------------------------------------------------------------
| 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 great to relax.
|
*/
require __DIR__.'/../../laravel/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__.'/../../laravel/bootstrap/app.php';
... laravel codes
Problem:
When i try to enter http://example.com/dev/ browser throws error:
This page isn’t working
mysite.com didn’t send any data.
ERR_EMPTY_RESPONSE
THERE ARE NO ANY INFORMATION/SOLUTION FOR THIS PROBLEM IN THE INTERNET.
ANY SOLUTION?
Your entire project should be inside your public_html folder. Then move all the contents of your public folder to public_html as well. Then edit your index.php to match the proper directory for autoload.php and app.php
From your text I assume you want call Laravel via http://example.com/dev/ If you hoster allows symlinks, you can try this.
-> laravel
-> app
-> ...
-> public // symlinked to public_html/example.com/dev
-> ...
-> public_html
-> example.com folders & files
-> dev // This is a symlink to laravel/public
A better approach in my opinion would be to create a subdomain and call Laravel like http://dev.example.com. It depends on your hoster how you can do this.