Im having problems deploying my Laravel 5 Project on Go Daddy Plesk . I'm getting Internal 500 Error. Here's the folder structure.
/Root Directory
/app
/boostrap
/config
/database
/storage
/resources
/vendor
/httpdocs
index.php
/css
/js
Then my server.php
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylorotwell#gmail.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/httpdocs'.$uri))
{
return false;
}
require_once __DIR__.'/httpdocs/index.php';
So as you can see, I deleted my public folder in my laravel and transfered all the public contents inside httpdocs but I already changed the path on server.php
did I missed anything?
My .htaccess under httpdocs
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
the one reason is you wouldn't have set permission for your public folder. Another you would need 5.5+ php version in order to make Laravel work. First set permission and try changing php version. I strongly believe this would work.
Related
[UPDATE]
When I use this code on the server it works but not on the localhost
{{ URL::asset('public/js/jquery-2.2.4.min.js') }}
I'm deploying Laravel project in a folder in the root so here's the .env
APP_URL=http://example.com/project
PUB_URL=/public
edited index.php file which is in the root
require __DIR__.'/../project/bootstrap/autoload.php';
//require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/../project/bootstrap/app.php';
//$app = require_once __DIR__.'/bootstrap/app.php';
But all css and js files located in the public folder won't load I get log errors referring to the root path
GET http://example.com/js/jquery-2.2.4.min.js net::ERR_ABORTED 404 (Not Found)
These files are included in the blade like this
<script src="/js/jquery-2.2.4.min.js"></script>
And htaccess content
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes…
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller…
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
How to fix this to fetch js, css file and images from the public directory inside the "project" folder not from the root domain?
well i have setup slim skeleton directly in public_html where in that directory their is first .htaccess file contain routing to public folder.
first .htaccess contain:
RewriteEngine On
RewriteBase /public/
RewriteRule ^$ public/
due to which my domain is directly pointing to public/index.php
which contain second .htaccess file with slimframework standard .htaccess file:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
Because of this my css and js files are not loaded inside template and they are going as in console
GET http://domain.com/css/bootstrap.min.css
returning 404 error
I am struugling with this issue from two days but still not able to get where should i change as its working fine on my local server but not over godaddy server.
I was wondering if anyone has had any experience deploying larval to blue host? I was flowing an youtube tutorial that showed how to deploy a larval application to a shared hosting service. It was using Godaddy.com, however, i was using Bluehost, and it didn't work as expected. However I managed to getting to not return an internal server error.
What I did was to configure the .env file so that it had my correct database information and my APP_URL to point to my domain.
The youtube tutorial said I should also remove everything from the public folder and place it in the applications main folder, which on Bluehost is the public_html folder. I also changed the .htaccess and removed the public in the rewrite that handles the redirects for trailing slashed.
Now, when I point to my website, all that is served up is a blank screen. but something seems to be working because I uploaded an html webpage that renders to the browser. I just wondering where do I go from here to get the entire site running.
i'm using php 5.6.
Any help would be great. Thank you
I think you are using shared hosting
Follow these steps
1: After upload files to public_html move all your /public files in public_html folder All files like index.php, .htaccess and assets folder etc
2: Find the following line in index.php
require __DIR__.’/../bootstrap/autoload.php’;
require __DIR__.’/../project/bootstrap/autoload.php’;
change to
require __DIR__.’/bootstrap/autoload.php’;
require __DIR__.’/project/bootstrap/autoload.php’;
That’s it. Well then, have fun.
check that the PHP version is correct for Laravel
in cPanle enable FastCGI for PHP
open file .htaccess located in /public and edit
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteBase /public/
# For security reasons, Option followsymlinks cannot be overridden.
# Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
This is my .htaccess codes which are different in different server.
#Default Setup
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
//bluehost------------
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I am working on a Rest Api for my application. This is my application structure
api
-config
-modules
--v1
---controllers
---models
-runtime
-tests
-web
backend
common
console
environments
frontend
I tried runing the following url http://192.168.1.4/~user/urshow/api/modules/v1/web/users
I got a Not found Error. I do have a controller named Users inside controllers folder.
My .htaccess file is like this (which is inside urshow/api/web)
RewriteEngine on
RewriteBase /~user/urshow/api/modules/v1/web/
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php
I found the solution. I had made some mistakes. First my .htaccess file was incorrect.
i had this line before RewriteBase /~user/urshow/api/modules/web/
i changed it to RewriteBase /~user/urshow/api/web/
also the url which i was trying was also wrong http://192.168.1.4/~user/urshow/api/web/movies/details
correct url is http://192.168.1.4/~user/urshow/api/web/v1/movies/details.
You haven't added the rest of the url to the redirect. Try using this on your last line;
RewriteRule ^(.*)$ index.php$1
I have a questions while install Symfony framework on my shared hosting account.(hostmonster)
I can access SSH now, but I can not access httpd file.
so, I do not know how to set below setting using command line.
**
<Directory "/$data_dir/symfony/web/sf">
AllowOverride All
Allow from All
</Directory>
<VirtualHost *:80>
ServerName myapp.example.com
DocumentRoot "/home/steve/myproject/web"
DirectoryIndex index.php
Alias /sf /$data_dir/symfony/web/sf
<Directory "/home/steve/myproject/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
**
,
I tried this,
**
chmod 777 /home1/myaccount/php/data/symfony/web
chmod 777 /home1/myaccount/public_html/symfony/web
**
But nothing changed.
when access mydomain.com, it show like this
#!/usr/bin/env php
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier#symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
chdir(dirname(__FILE__));
require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');
include(sfCoreAutoload::getInstance()->getBaseDir().'/command/cli.php');
Please advice me how should I do .?
Thanks!
You need to enable mod_rewrite on your apache instance. If you cannot access the httpd configuration file, then you should create a .htaccess file in your web root.
Here is an example .htaccess file typical with symfony installs:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
If you are seeing
#!/usr/bin/env php
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier#symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
chdir(dirname(__FILE__));
require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');
include(sfCoreAutoload::getInstance()->getBaseDir().'/command/cli.php');
when you head to yourdomain.com, you simply do not have PHP enabled. You may not even have it installed. A quick check is to create a file called info.php and put the following as it's contents
<?php phpinfo(); ?>
Upload info.php and navigate to yourdomain.com/info.php. If you are seeing the code you just entered you do not have php installed or enabled on your server. If you see a massive list of configuration items than I'm wrong.