i got a problem after i finish to set up LAMP and installed my laravel 4 application. Everything seem went well, when i go on my ip address url, it show me the first page of
try this inside the folder:
chcon -R -t httpd_sys_content_t *
The webserver starts as a daemon (service) under a particular user. That user is defined in httpd.conf. By default that user will be apache. Don't confuse the apache user with the httpd process. The latter is a webserver daemon and the former is the user under which it is going to run. If the folder you created belongs to root or a user other than the one defined in httpd.conf then apache won't be able to access it. The way to identify this problem is to go to the folder and do ls -l. If the user define in httpd.conf is apache then in order for it to access the folder, you should see:
drwxr-xr-x. 2 apache apache 4096 Jan 8 2013 public_folder
Note, it says 'apache apache', meaning it belongs to the apache user and group. If you created it via root then you will probably see:
drwxr-xr-x. 2 root root 4096 Jan 8 2013 public_folder
The apache user cannot access the folder defined by root. To solve this problem run the command:
chown -R apache:apache myfolder
The -R option is recursive, so it will update ownership for ALL folders and files within that folder to the apache user.
If your ownership if fine, then trying 'temporarily' turning off selinux. On centos you do:
setenforce 0
Which will turn off selinux till the next restart. Ideally, you will want to leave selinux on for additional security and set a valid context for your apache files and folders.
If turning off selinux does work, then you probably have the wrong security context for your files and folders. run the following command to restore your security contexts:
restorecon -R -v /var/www/
chcon -R -t httpd_sys_content_t *
did the trick for me.
If you're using CentOS it could be an issue with selinux. Check to see if selinux is enabled with 'sestatus'. If it is enabled, you can check to see if that is the issue (temporarily) using 'sudo setenforce 0'. If apache can serve the site, then you just need to change the context of the files recursively using 'sudo chcon -R -t httpd_sys_content_t' (you can check the existing context using 'ls -Z'.
Selinux may not be the issue, but it's worth checking on.
from php5.conf in /etc/apache2/mods-available
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_value engine Off
# </Directory>
#</IfModule>