Hosting Laravel 5.3 system in subdomain

2

Good afternoon. I am having a problem with uparing my system created with laravel 5.3 for hosting.

I created a folder for the Project and placed the files from the public folder for public_html. I have made the redirects, but I am having an ERROR 500 error - INTERNAL SERVER ERROR

I did some research, and I saw some problems related to configuring the .htaccess file, the php version of tbm is ok.

The .htaccess file looks like this:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
            Options -MultiViews
    </IfModule>
AddHandler application/x-httpd-php55 .php

    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>

Did anyone ever go through something like this and could you give me some help?

    
asked by anonymous 10.01.2017 / 21:12

2 answers

2

It does not look like a mod_rewrite error, if it were it would be for not having active, but there is a if .

First to be sure of the problem, look for the PHP error log (it's a .txt file, it's set up in php.ini)

Note that Laravel 5.3 as per the documentation shows link needs:

  • PHP 5.6.4 or higher
  • OpenSSL extension for PHP
  • PDO extension for PHP
  • Mbstring extension for PHP
  • Tokenizer Extension for PHP
  • XML Extension for PHP

If you are in a lower version of 5.6.4 this error will occur with certainty. Not having the active extensions also causes the error sometimes, note that the 500 error is displayed because PHP is in production mode and therefore does not display details of the error, it is best to look at the log.

All extensions can be enabled in php.ini if it is Like-unix hosting:

extension=openssl.so
extension=pdo.so
extension=pdo_mysql.so
extension=mbstring.so
extension=tokenizer.so

The XML I think compiles along with PHP, so if it does not (which I think is impossible) it will be kind of difficult to solve.

  

Note: The PDO example is for mysql, if it is another database, see link

If it is Windows-server:

extension=php_openssl.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_mbstring.dll
extension=php_tokenizer.dll

And also need to have mod_rewrite enabled, but this usually does not cause 500 error.

To find out where the log is, you can create a file named teste.php (delete later) and put something like:

<?php
echo 'Log:';
var_dump(ini_get('error_log'));

Then run it like this: http://meusite.com/teste.php , if NULL appears because it does not have logging configured, then you have to configure it and access to PHP.INI depends a lot on how the server releases, so you have to talk to the support of the hosting.

Moving to public_html

As I explained here link , also note that the folder structure should look like this:

/home/user/
   |--- /access-logs     (pasta padrão em servidores com cpanel)
   |--- /etc             (pasta padrão em servidores com cpanel)
   |--- /public_ftp      (pasta padrão em servidores com cpanel)
   |--- /tmp             (pasta padrão em servidores com cpanel)
   |--- /public_html     (pasta padrão em servidores com cpanel)
          |--- index.php (arquivo da pasta /public)
          |--- .htaccess (arquivo da pasta /public)
   |--- /app             (pasta do seu projeto laravel)
   |--- /bootstrap       (pasta do seu projeto laravel)
   |--- /config          (pasta do seu projeto laravel)
   |--- /database        (pasta do seu projeto laravel)
    
11.01.2017 / 15:20
1

Giving feedback on the problem ...

I followed the hostgator support tip and used this tutorial to install laravel on the server via composer:

link

With the tutorial I was able to install laravel, I created a new project and replaced the files for my project that I was trying to upload to the server. Everything working now!

Thank you Guilherme Nascimento for the help.

    
12.01.2017 / 00:52