XAMPP localhost returns object not found after installing Laravel

最后都变了- 提交于 2019-11-30 08:44:53

Look into your /etc/httpd.conf file and see if you have Virtual hosts activated.

If so, check your etc/extra/httpd-vhosts.conf file. You might have set up a VirtualHost already.

EDIT: I have found that once you turn on Virtual Hosts, XAMPP needs a default VirtualHost for your basic htdocs files

Try adding a default VirtualHost (at the bottom of the file) like so:

<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/htdocs"
<Directory "/Applications/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>

It sounds to me like it is a problem with the way your directories are configured. Be sure to create a Virtual Host (if you're using Apache) that points to the public folder within your application directory.

For example, if your Laravel project is under /Applications/XAMPP/htdocs/Laravel then set up a Virtual Host like this:

<VirtualHost *:80>
    DocumentRoot /Applications/XAMPP/htdocs/Laravel/public

    # Other directives here
</VirtualHost>

Additionaly, if you're working with PHP >= 5.4, SSH into the application folder and run

./artisan serve

(Be sure that your PHP executable is in your PATH variable). Then go localhost:8000 and you should have your application running. Running this command runs the PHP built-in webserver and saves you the trouble of configuring virtual hosts.

In your Apache's http.conf, find the DocumentRoot line and add the subdirectory /public on the end.

Once that is done and you've restarted Apache, you'll be able to access everything which is contained within your htdocs/public folder (including subdirectories of that folder), along with any routes you've defined in Laravel.

Laravel is designed to be set up this way as to protect the code and files by not having them in the folder which is served out to the web.

I don't know if you're running L4 or L3. However, launch CLI and

$ cd ./path/to/project

Then for L4:

$ php artisan serve

For L3:

$ php -S localhost:8000 -t public

Now you can go to localhost:8000 and see your application.

user3148161

You're having problem because the object really doesn't exist in your htdocs directory. You don't have to append xampp after localhost or 127.0.0.1 because xampp will treat it as an object or a folder under htdocs.

if you want to access your blog, make sure you have a blog folder under htdocs and put in your URL localhost/blog

I have same issue and found that there are miss configuration in vhost. So that's are correct configuration.

in etc/extra/httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/laravel-master/public"
    ServerName laravel.local
    ErrorLog "logs/laravel-master-error.log"
     <Directory D:/xampp/htdocs/laravel-master/public>  
        AllowOverride All
        Order Allow,Deny
        Allow From All
    </Directory>
</VirtualHost>

In the hosts file

127.0.0.1 laravel.local
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!