How to Design Wamp for Lamp

Asked

Viewed 130 times

0

I have a Windows finished project (wampserver) using Laravel 5.2 in php 5.5.12 working perfectly.

I’d like to know how to copy it to the server that is in Centos 7. Which is PHP 7. If I install Laravel on it it takes Laravel 5.5.

I tried to copy the project to the server and separate the public folder from the rest of the project, but it just finds the main route, which in case is my login

my route is like this:

app Routes.php

Route::get('/', function () {
    return view('login');
});

Route::post('/logar', 'UsuarioController@logar');

When I try to log in, it gives error 404

The requested URL /myproject/logar was not found on this server.

He’s already got the permits

My login form looks like this:

login.blade.php

        <form action="{{ action('UsuarioController@logar') }}" method="post">
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <div class="form-group has-feedback">
                <input type="text" class="form-control" placeholder="Usuário" name="login">
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="Senha" name="senha">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-8">

                </div>
                <!-- /.col -->
                <div class="col-xs-4">
                    <button type="submit" class="btn btn-primary btn-block btn-flat">Logar</button>
                </div>
                <!-- /.col -->
            </div>
        </form>

My controller is like this:

Usuariocontroller.php

    public function logar(){
        echo "Principal";
    }

    public function login(){
        return view('login');
    }

    public function sair(){
        Session::flush();
        return redirect(  )->action( 'UsuarioController@login' );
    }

Detail:

If I create an Laravel project in Centos itself, it works perfectly.

I just had to add the block to httpd.conf

<Directory "/var/www/html/portal/myproject">    
    Options Indexes FollowSymLinks    
    AllowOverride all    
    Require all granted
</Directory>

I’m sure I was wrong about something, but where?

  • 1

    Young man, this isn’t about LAMP, WAMP or XAMPP. The problem is that you programmed in a version of PHP (with a version of Laravel) and are trying to publish using a newer version both PHP and Laravel. PHP itself already has some compatibility problems between smaller versions, imagine the difference that should not be from PHP 5.x to PHP 7. PHP 7 is to be completely different from the previous ones. Maybe you can even make your application "run", but you will end up finding problems halfway.

  • @LINQ beyond what you said, I’m thinking that the problem may be Mod_rewrite missing on the new server what you think ?

  • 2

    @Otto Yes, the initial problem is probably only with Apache itself.

  • mod_rewrite is active

  • So it’s not possible? I have to create another project on the server and copy my code there?

1 answer

-1

opens the public_html/index.php file and modifies the original directory:

require __DIR__ . '/.. /bootstrap/autoload.php';

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

for

require __DIR__ . '/.. /.. /bootstrap/autoload.php';

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

  • I did and it didn’t work

  • was an example, type, must be in agreement with the directories where you hosted, if it is in another folder, have to insert the right directory!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.