Configure Apache2 with PHP 5.6 to use FuelPHP

1

Well come on, I use ubuntu , php5.6 , apache2 , mysql-server %% FuelPHP . And while I'm using the% xampp that can certinho run my applications (however I have to start him always and he will not let me log in with more than one user). So I want to start using machine apache without depending on xampp .

The problem is this, when I access my system with localhost/meuprojeto/public_html/ it throws me to ( localhost/meuprojeto/public_html/users/login ) which would be my correct login page but gives the following error:

  

The requested URL / myupdate / public_html / users / login was not found on this server

I suspect that the error is in apache2.conf , which is not recognizing the .htaccess that is inside /meuprojeto/public_html/ . The apache2.conf is found as follows:

Directory

    Options FollowSymLinks
    AllowOverride None
    Require all denied

/Directory

Directory /usr/share

    AllowOverride None
    Require all granted

/Directory

Directory /var/www

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

/Directory

I would like you to help me find the error, or tell me the possible error.

    
asked by anonymous 12.06.2015 / 17:15

1 answer

1

Your problem is certainly related to VirtualHost, which is nothing more than the one responsible for redirecting a certain address to a location other than the localhost document root (explaining in a simple way).

So instead of directly accessing your localhost application, always create a virtual host. This reduces the amount of directory and redirection issues.

By simply doing the following: create a virtual host for fuelphp.local (or whatever you prefer):

# altere o fuelphp.local para o endereço que desejar
<VirtualHost *:80>
        ServerName fuelphp.local
        ServerAlias fuelphp.local
        ServerAdmin [email protected]
        DocumentRoot /var/www/meuprojeto/public_html

        <Directory /var/www/meuprojeto/public_html>
            Options Indexes Includes FollowSymlinks ExecCGI
            Require all granted
            IndexOptions +FancyIndexing
            Order allow,deny
            Allow from all
            DirectoryIndex index.html index.htm default.htm index.php
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Observations

  • Do not forget to add the address you chose in your hosts files: /etc/hosts or C:/Windows/System32/drivers/etc/hosts .
    • Just add the following line to the end of the file: 127.0.0.1 fuelphp.local (or any other address of your choice)
  • Verify that mod_rewrite is enabled in apache.conf ( /etc/apache2/apache.conf ), otherwise redirects will not work correctly.
    • One way to test this is to create a file - info.php for example - in the document root of localhost, add the following code in the file: <?php phpinfo(); ?> - and call it by browser. This allows you to search whether the extension exists or not.
12.06.2015 / 21:37