I tried to install a fresh laravel project on CentOS 7 running Apache/PHP 5.6/MariaDB.
on /var/www
:
composer create-project laravel/laravel devil
chmod -R 777 devil/storage
chmod -R 777 devil/vendor
When I tried to access it from browser, it seems the blade extension is not working. It keep showing blank page without any error.
I checked the HTTP response showing 500 (Internal server error) on my chrome web developer extension.
The app only work if I don't use blade templating at all (not use .blade.php extension and the blade syntax).
Below is the folder structure
drwxr-xr-x. 10 adzar adzar 4096 Mar 25 04:06 app
-rwxr-xr-x. 1 adzar adzar 1635 Mar 25 04:06 artisan
drwxr-xr-x. 2 adzar adzar 39 Mar 25 04:06 bootstrap
-rw-r--r--. 1 adzar adzar 788 Mar 25 04:06 composer.json
-rw-r--r--. 1 adzar adzar 100509 Mar 25 04:06 composer.lock
drwxr-xr-x. 2 adzar adzar 4096 Mar 25 04:06 config
drwxr-xr-x. 4 adzar adzar 52 Mar 25 04:06 database
-rw-r--r--. 1 adzar adzar 503 Mar 25 04:06 gulpfile.js
-rw-r--r--. 1 adzar adzar 98 Mar 25 04:06 package.json
-rw-r--r--. 1 adzar adzar 87 Mar 25 04:06 phpspec.yml
-rw-r--r--. 1 adzar adzar 777 Mar 25 04:06 phpunit.xml
drwxr-xr-x. 4 adzar adzar 95 Mar 25 04:06 public
-rw-r--r--. 1 adzar adzar 1724 Mar 25 04:06 readme.md
drwxr-xr-x. 5 adzar adzar 42 Mar 25 04:06 resources
-rw-r--r--. 1 adzar adzar 560 Mar 25 04:06 server.php
drwxrwxrwx. 5 adzar adzar 60 Mar 25 04:06 storage
drwxr-xr-x. 2 adzar adzar 47 Mar 25 04:06 tests
drwxrwxrwx. 26 adzar adzar 4096 Apr 8 18:31 vendor
The .env file
(unchanged)
APP_ENV=local
APP_DEBUG=false
APP_KEY=EOvUHTpMtavKDMx1GdkREtbves8PVEUb
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
I use IP address (100.255.XXX.XXX)
to access my app using apache virtual host. Below is my /etc/httpd/conf/httpd.conf
.
...
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 100.255.XXX.XXX
...
<VirtualHost *:80>
ServerName 100.255.XXX.XXX
DocumentRoot /var/www/devil/public
<Directory /var/www/devil>
AllowOverride All
</Directory>
</VirtualHost>
Please help, thank you.
Update
After hours of trying I finally able to fix the problem by disabling SELinux.
setenforce 0
However, I still have no idea why.
Blade templating caches its templates in the file system extensively.
Therefore, you need to make sure that the appropriate folders are writable by your web server.
Laravel may require some permissions to be configured: folders within
storage
andvendor
require write access by the web server.
Fix your folder permissions by running the following command in console:
chmod 664 /var/www/devil/storage -R
chmod 664 /var/www/devil/vendor -R
Source: http://laravel.com/docs/5.0/installation#configuration
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.