laravel 4 does not work on Windows XAMPP - php

On Windows 7 cmd I have run composer create-project laravel/laravel blog --prefer-dist from `C:\xampp\htdocs\lara. Everything is downloaded and installed fine.
However, when I try to access http://localhost/lara/blog it shows the directory listing of apache. I followed the instruction in the documentation during the installation.
I noticed the following notes:
C:\xampp\htdocs\lara\blog does not has any index.php or .htaccess
C:\xampp\htdocs\lara\blog\app also, does not has any index.php or .htaccess
Only accessing http://localhost/lara/blog/public opens a page with the laravel logo and the words "You have arrived"
I could not able to know what's the problem?

Laravel's folder structure uses the public folder as the WWW root, effectively placing all your application's files outside of the web root to help keep them secure. What you are experiencing is normal.
You'll have to either access your application from the http://localhost/lara/blog/public URL, or set up a virtual host URL (e.g. http://testblog.dev) that is pointed to the public folder. I do not develop on Windows/XAMPP so I cannot specifically tell you how to do that part.

If you're running php > 5.4 you can serve the app using the builtin server from command prompt as well (for development purposes):
php artisan serve

I have an answer on How to install Laravel via Laravel Installer on Windows?
or
http://goo.gl/uftcSo
for more details
Hope that helps.

Related

Silverstripe install.php can't find <mysite>

I have working SS v3.4 project locally. Now I want to deploy it. I've copied files to the server, run composer install to install vendor libraries. When I run install.php all requirements are fine except for missing mysite folder errors. That's intended because I renamed my project folder to let's say mydomain and it works fine on localhost. AFAIK SS should pick up the custom folder and recognise it as THE page folder. Somehow it doesn't happen. Any ideas why?
This is expected, since the installer specifically looks for "mysite".
You probably have two options:
Rename app to mysite on the serve, re-run the installer then rename the folder back to app
Don't run the installer at all - if you configure your own _ss_environment.php file and ensure assets folder is writeable you shouldn't need it

Run laravel project in localhost

I have installed laravel by composer create-project laravel/laravel –-prefer-dist
after this run php artisan serve command to laravel project directory and get this result.
Laravel development server started: http://127.0.0.1:8000
But when i go to http://127.0.0.1:8000 in browser laravel project not running and give error
This site can’t be reached
127.0.0.1 refused to connect.
but http://localhost/laravel/public/ it is working. Can anyone tell me that what is proper way to run this laravel project.
Try to run in different port
php artisan serve --port=9000
and then try http://127.0.0.1:9000 will work.
As might be on port 8000 something already running on your system will not make it work.
And you can also run your laravel project without artisan serve command
If anyone wants to make the application public, the more easy and fastest way is:
Rename the "server.php" file in root directory, in "index.php"
Move your .htaccess from public folder to root directory
Make your directory accessible to Apache2 (set all file permissions
to 777).
At starting level, you can use url like this http://127.0.0.1:8000 with port-number. but in further level you must working with simple url like http://localhost/laravel/public/.
One more thing - you should remove "public" keyword from url, so you access direct your root-project. Review this link - Laravel 5 - Remove public from URL
I had that problem too! And couldn't solve it. So I installed openserver from https://ospanel.io/ and put my site on the folder domains (Windows 10), then I just start Open Server and click "My Sites" and choose my site - it opened in my browser which set by default on Open Server program and click the folder on my browser cooled "public" and there you go -> your site is working.
I now that isn't solve the problem with cmd and start thought cmd and server like http://127.0.0.1:8000, but you can take access to your local site through http://'your site'/public/'your pages'
Good luck!
Changing the port will help.
php artisan serve --port=9000
worked for me
Try this
php -S 127.0.0.2:8000 -t public/
It will start your local development to http://127.0.0.2:8000 which will work great.
OR
You can try instead
php -S 127.0.0.1:8000 -t public/ It will work in any browser as compare to command php artisan serve which open url http://127.0.0.1:8000.
Successfully landed to Laravel page by the following steps.
Note: This is after the successful installation and configuration.
Was in /var/www/html/
Created the project using the following command after Laravel installation successfully
$laravel new firstapp
here firstapp is my project
cd to firstapp (folder created with project creation with $laravel new firstapp)
serve using the following command
$ php artisan serve
The project ready to serve with the following statement as below
Laravel development server started: http://127.0.0.1:8000
You can access the laravel page using the following URL
http:///firstapp/public/
Sometimes this occur when you have installed an anti virus software. Anti-virus deleting your "server.php" file. For that you can create an exception in anti-virus for "server.php" file or creating a "server.php". You can find relevant code for the file searching. Basically server refuse to connect occurs when the "server.php" deleted or removed from the file path.

What's the best way to run a laravel project with out using artisan serve?

guys I have a laravel project and its working fine. Every time I start the project by typing the command php artisan serve and then by typing the url localhost:8000 in my browser. But now I want to start my project only by typing the url localhost/projectname.
So I did a little bit of digging and found out a way to do this, I made it possible by changing the server.php file from root directory to index.php and copying the htaccess file from public folder to root directory`. This way my browser loaded only html file or php file but css files and js files were not loaded so I had to modify there link on the blade file for example:
Previously a style.css file was linked as:
<link rel="stylesheet" type="text/css" href="{{asset('front_end/assets/css/style.css')}}">
Now I link the same style.css file as below:
<link rel="stylesheet" type="text/css" href="{{asset('/public/front_end/assets/css/style.css')}}">
And It works fine.
But now I have found another problem, I have stored some files (images) in the the storage/app/public/myfolder directory so to access the files I had to use the command php artisan storage:link command and to access the files(images) from above mentioned directory from blade file I use the code below:
<img src="{{$url = Storage::url('myfolder/'.$company->logo_name)}}">
This code did worked only worked when I used to start my project using php artisan serve command. Now I its not linking so what should I do? And also can you guys tell me the way that I changed the server.php file to index.php is the right way or not? And what you guys do in your real projects?
Thank You.
When deploying a Laravel project you want your nginx or apache configuration to point to your public path of your project. Changing the server.php or index.php files are not necessary.
Apache Config Example:
<VirtualHost *:80>
ServerName project.dev
DocumentRoot "/home/vagrant/projects/project/public"
<Directory "/home/vagrant/projects/project/public">
AllowOverride all
</Directory>
</VirtualHost>
As you can see with this apache config example, it points to the public directory of your project.
You can achieve this locally by installing either Apache or nginx on your local machine.
I would recommend following Laravel's documentation guide on using Vagrant's Homestead to get an idea of how this is working before you decide to run this on a server. A link here
There is a couple of options you can take to achieve essentially the same goal. This depends on the machine you are running on and personal preference.
Laravel Valet for Mac
Laravel Homestead
WAMP for Windows
MAMP for Mac
You don't need to modify any file.
You need one of this:
Web server installed locally, Apache or Nginx
A Vagrant Virtual machine for running the project like in production environemnts like Homestead
Valet
If you decide to go with Web Server, you just need to consider to point to project/public folder instead of project.
Doing with one of this options, you won't need to modify the assets url, since public shouldn't be part of your url in any case.
First of all, don't do any tweaks in server.php file, it's fine.
To run your project with url like, http://localhost/my-project.dev or simply my http://project.dev, use WAMP or XAMPP (if working on a windows machine) and lamp for linux. You can also checkout Laravel's Homestead.
Then setup virtual host.
See this tutorial for setting up virtual host on WAMP - http://www.coderomeos.org/how-to-set-up-virtual-host-on-wamp-server
And don't put your assets in public/assets folder to prevent using storage link.

How can I install and use website using drupal8 composer?

I tried to run inststruction from the official website but I cannot understand why I cannot access my website and what do I need to fix?
My website is in the directory /var/www/drupal8.
The files are as follows:
I installed it using composer from here https://www.drupal.org/node/2718229
What do I need to do next? I want to access my website in the browser as I can in Drupal 7 just typing my local website name, for example drupal7.loc
Configure your VirtualHost entry to point to drupal8/web. The actual Drupal root directory is the web directory. That's where the index.php file, etc. are.
Also, your screenshot doesn't show it, but make sure you have a drupal8/web/core directory. It should be there if you ran the composer create-project command, but if not, you'll need to run composer install in the project root (/drupal8) before your site will load.

PHP site developed using Laravel 5 is not getting rendered after Hosting

I developed a php site using Laravel 5 and tried hosting it in a LAN Server running UBUNTU 14. But when I navigated the page I'm just getting a Blank Page. No errors at all. I inserted a simple echo statement in index.php and I got the relevant echo.
There can be many reason. If you are using Laravel 5.0, you will need at least PHP 5.4. For Laravel 5.1, you will need 5.5.9. But if you have installed PHP using sudo apt-get install php5 you are most likely to have PHP 5.5.9 or later. Because that is the default version for Ubuntu 14.04 LTS. try running php -v from terminal to check the version.
There can also be a Permission issue for storage folder.
From project root folder run following command,
sudo chmod 755 -R storage
Basically, laravel needs write access to storage folder to write a log in storage/log directory or to write a compiled view files in storage/framework/views etc. You can try 755 first. If that does not work try 777.
Laravel shows nothing on certain fatal errors. For instance a class that can't be found or the storage directory and subdirectories that should be writable for the web user (www-data). This should show up in the error log of the webserver.
I believe you have permissions issue chmod 755 storage folder located in the root of your web project. If that doesn't works do it 777.
The reason why echo in the index.php is working is because this is the first file called when you execute the laravel app and the index file calls services provider and other required files, in this process the app creates a cache file under storage/framework/views/ folder but these files does not have write permissions, but as you echo something you get that output because it has been called even before anything was called.

Categories