Configure Apache2 with PHP 5.6 to use Fuelphp

Asked

Viewed 332 times

1

Well come on, I use Ubuntu, php5.6, apache2, mysql-server, FuelPHP. And for now I’m using the xampp that can run my applications correctly (however I have to start it always and it does not let me log in with more than one user). So I want to start using the machine apache without depending on the xampp.

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

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

I suspect the error is in apache2.conf, that is not recognizing the .htaccess which sits within /meuprojeto/public_html/. The apache2.conf is 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’d like you to help me find the mistake, or tell me the possible mistake.

1 answer

1

Your problem is certainly related to Virtualhost, which is nothing more than the person responsible for redirecting a particular address to a location other than the localhost’s root Document (simply explaining).

So instead of directly accessing your application from localhost, always create a virtual host. This reduces the amount of problems related to directories and redirects.

So just do the following: create a virtual host for the address fuelphp.place (or any other 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>

Remarks

  • Don’t forget to add the address you chose to your hosts files: /etc/hosts or C:/Windows/System32/drivers/etc/hosts.
    • Just add the following line at the end of the file: 127.0.0.1 fuelphp.local (or any other address of your choice)
  • Check whether the mod_rewrite is entitled to apache.conf (/etc/apache2/apache.conf), otherwise redirects will not work properly.
    • One way to test this is to create a file - info.php for example - in localhost’s Document root, add the following code to the file: <?php phpinfo(); ?> - and call it by the browser. With this you can search whether the extension exists or not.
  • The mod_rewrite is Apache, why check in php settings if it is configured?

  • @gmsantos forgiveness. I was confused when preparing the answer.

Browser other questions tagged

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