user0129e021939232
user0129e021939232

Reputation: 6355

Laravel setup failed to open stream

I'm trying to setup laravel but its proving to be a right mere! I've cloned it from github and also used composer to clone laravel and I've got both of these techniques working which is good because its something I really wanted to learn. Simpler than I thought.

However when I try to navigate to my laravel directory which is called iProject so I type into my browser localhost/iProject I get a list of directories which is not what I expected, I expected to be directed to at least the hello.php page.

I've tired another technique as described in a Net-tuts tutorial which is setting up a listening port and there I am then going through localhost:8888, but when using this technique the following error message appears:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'public/' include_path='.;C:\xampp\php\PEAR') in Unknown on line 0

Setting up Virtual Host (as per responses received)

When I setup the virtual host I am redirected to xampp the url goes to iproject.dev/xampp

I've setup a virtual host as so:

C:\Windows\System32\drivers\etc\hosts

127.0.0.1 iproject.dev

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/iProject/public"
ServerName iproject.dev
ServerAlias iproject.dev
ErrorLog "logs/iProject.liog"
CustomLog "logs/custom.iProject.log" combined
<Directory "C:/xampp/htdocs/iProject/public">
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>
</VirtualHost>

Upvotes: 2

Views: 2804

Answers (1)

The Alpha
The Alpha

Reputation: 146269

You can simply use (I've same setup for all of my projects) in httpd-vhosts.conf file

<VirtualHost iproject.dev>
    DocumentRoot "C:/xampp/htdocs/iProject/public"
    ServerName iproject.dev
</VirtualHost>

Also, add the following line in you C:\Windows\System32\drivers\etc\hosts file

127.0.0.2      iproject.dev # 127.0.0.2 could be 127.0.0.3 or ...4/...5

For example, this is a part of my hosts file in win-7

127.0.0.1       localhost
127.0.0.1       127.0.0.1
127.0.0.2       alimsearch.dev # alimsearch.co.uk
127.0.0.3       laravel4.dev
# ...

And part of my httpd-vhosts.conf file

<VirtualHost alimsearch.dev>
    DocumentRoot "D:/xampp/htdocs/alimsearch/public"
    ServerName alimsearch.dev
</VirtualHost>

<VirtualHost laravel4.dev>
    DocumentRoot "D:/xampp/htdocs/laravel4/public"
    ServerName laravel4.dev
</VirtualHost>

Upvotes: 4

Related Questions