Back

Laravel production deployment on 1and1


Hi there,

I started a small web application using Laravel, and now I want to deploy in on my 1and1 production server, and I got two issues :

  • First : I didn't succeeded to configure the .htaccess files (the one in the root and the one in public/) in order to access to "http://example.com/app/public/" by going to "http://example.com".

  • And when I access to my server using ssh and I type "php5.5 artisan" in the command line, I have no commands !

Please note that I deploy my app using git and I did a composer install after the git pull...

Any ideas ?

shabushabu replied 5 years ago

You shouldn't have to change your htaccess file. Just point the web root to your public folder. It should probably be either php or php5. Never seen php5.5. And when you do php artisan, then you need to be in the root folder of your application (where the artisan file sits) or specify the path to it as part of the command.

extjac replied 5 years ago

I use 1and1. Make sure you point your domain to the public folder.

this is my htaccess file

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

    RewriteEngine On

	#1and1 to enable PHP 5.4
	AddHandler x-mapp-php6 .php 

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
martylamoureux replied 5 years ago

shabushabu said:

You shouldn't have to change your htaccess file. Just point the web root to your public folder. It should probably be either php or php5. Never seen php5.5. And when you do php artisan, then you need to be in the root folder of your application (where the artisan file sits) or specify the path to it as part of the command.

You always need to trick your .htaccess with 1and1, theirs servers are strangely configured, and I needed to customize the default .htaccess of a Symfony website.

martylamoureux replied 5 years ago

extjac said:

I use 1and1. Make sure you point your domain to the public folder.

this is my htaccess file


  RewriteBase /
   
       Options -MultiViews
   

   RewriteEngine On

  #1and1 to enable PHP 5.4
  AddHandler x-mapp-php6 .php 

   # Redirect Trailing Slashes...
   RewriteRule ^(.*)/$ /$1 [L,R=301]

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

I done what you did, I succeeded to have the index page displaying correctly, but when I try to access a route pointing to any other route than '/', I have a 500 Internal Server Error

martylamoureux replied 5 years ago

I found a solution, you juste have to replace the RewriteRule by :

RewriteRule ^ /index.php [L]

but I still have an empty list of commands in "php artisan"... (I only have the ones from way/generators)

EDIT : Here what I have when I do "php artisan list" :

$ php5 artisan list   
Laravel Framework version 4.1.24

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.
  --env               The environment the command should run under.

Available commands:
  help                         Displays help for a command
  list                         Lists commands
  workbench                    Create a new package workbench
generate
  generate:controller          Generate a controller
  generate:migration           Generate a new migration
  generate:model               Generate a model
  generate:pivot               Generate a pivot table
  generate:publish-templates   Copy generator templates for user modification
  generate:resource            Generate a new resource
  generate:scaffold            Scaffold a new resource (with boilerplate)
  generate:seed                Generate a database table seeder
  generate:view                Generate a view
martinhearn replied 5 years ago

The version of PHP CLI on 1&1 is too old to run Artisan unfortunately.

The best way to run Artisan is using a web interface (using https://github.com/jn-Jones/web-artisan for example)


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us