Hosting Laravel system 5.3 in subdomain

Asked

Viewed 1,529 times

2

Good afternoon. I have a problem to upgrade my system created with Laravel 5.3 for hosting.

I created a folder for Project and put the files in the folder public for public_html. I made the appropriate redirects, but I have an error ERROR 500 - INTERNAL SERVER ERROR

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

The . htaccess file is as follows:

<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>

Has anyone ever been through something like that And could give me a hand ?

  • I always use this, Julian... so I have no idea, I wish I could help. Try one of these links: https://www.google.pt/webhp?sourceid=chrome-instant&=1&espv=2&ie=UTF-8#q=remove+public+Standard

  • @Michael the same also http://answall.com/a/91799/3635

  • @Guilhermenascimento had already seen this, also had given +1. Good answer, I think it solves the pronoun of AP

2 answers

2

It doesn’t 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 up the PHP error log (it is a file . txt, this configured in php.ini)

Note that Laravel 5.3 as the documentation shows https://laravel.com/docs/5.3#server-Requirements accurate:

  • PHP 5.6.4 or greater
  • Openssl extension for PHP
  • PDO extension for PHP
  • Mbstring extension for PHP
  • Tokenizer extension for PHP
  • XML extension for PHP

If you’re in a version inferior to 5.6.4 this error will occur for sure. Not having active extensions also causes the error sometimes, note that the error 500 is displayed because PHP is in production mode and so does not show details of the error, it is best to look at the log.

All extensions can be enabled in php.ini if it’s Like-Unix hosting:

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

XML I believe is compiled together with PHP, so if you don’t have (which I find impossible) it will be kind of hard to solve.

Note: the PDO example is for mysql, if it is another database see http://php.net/manual/en/pdo.installation.php

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 you also need to have the mod_rewrite enabled, but this usually does not cause error 500.

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

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

So run him like this: http://meusite.com/teste.php, turn up NULL is because there is no log configured, so you will have to configure and access to PHP.INI depends a lot on how the server releases, so you will have to talk to the hosting support.

Moving to public_html

As I explained here /a/91799/3635, note also 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)
  • I changed the PHP version of the server to 7.0 and now it’s giving error: Fatal error: Out of memory (allocated 411041792) (tried to allocate 32768 bytes) in /home/user/system/bootstrap/autoload.php on line 1

  • @Julianomoura what is the php.ini memory setting for your php7? See memory_limit=

  • as I did not locate any php.ini file on the server I created one. I put memory_limit to 2048

  • @Julianomoura created where? It doesn’t make much sense and I think it doesn’t work. You have to edit php.ini or use php_mod (some hosts offer this as an alternative) or phprc, and memory limit has to have an M at the end, for example memory_limit=32M. Note: each Laravel request spent 7Mb of server memory (the minimum, the maximum not to affirm), so I recommend at least to use 32M, this of course will depend on the speed of your server, I also recommend that you activate Opcache: I recommend that you read this http://answall.com/a/152472/3635

  • I followed this tutorial to create php.ini https://faq.hostgator.com.br/content/70/321/pt-br/configura%C3%A7%C3%A3o-do-php-com-o-file-phpini.html

  • @Julianomoura blz, creates a file called teste.php in public_html and puts this <?php var_dump(ini_get('memory_limit')); and tell me what returns.

  • string(4) "256M"

  • @Julianomoura but Aravel still has some error?

  • Fatal error keeps popping up: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) in /home/calango3/system/bootstrap/autoload.php on line 35

  • @Julianomoura do you know that after editing php.ini you need to restart the machine? If you have not done so please restart it.

  • I contacted hostgator support and they informed me that the shared server has 256mb of memory. He recommended optimizing the system and trying again. I will install the Laravel on the server and create an application to check if it will work. Once you’ve done I give feedback

  • @Julianomoura do not forget to configure Opcache, I’m almost sure that this error is not due to lack of memory, but some fault in your installation of Opcache, type an extension not enabled.

Show 7 more comments

1

Giving a feedback on the problem ...

I followed the hostgator support tip and used this tutorial to install the server via Composer:

http://forum.hostgator.com.br/topic/1297-instalando-laravel/

With the tutorial I managed to install the Lockable, created a new project and replaces the files for my project that was trying to upgrade to the server. All working now !

Thank you Guilherme Nascimento for your help.

Browser other questions tagged

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