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.
Related
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.
I am a Centos 7 machine on which I have configured PHP with Apache and Slim Framework.
The simple code to check if the file exists and copy the code into a directory is working fine on one of the machine but not working on another machine. Its really weird.
Actually I am accessing the API through Apache to trigger this function.
Functions like shell_exec alaways return 0
copy function is also not workingg
file_exists also not working.
Any help or clue why this is wrong or debug this issue.
Thanks all for the help.
Problem was file permission issue.
The reason was all of the above function I was performing was on the file. Since the files has different permission for different user.
So If I hit the URL from browser it was through "Apache" user which does not have execute permission on the folder to access the file and read permission on the file.
In short
sudo chmod +rx file
sudo chmod +x "All the directory structure"
I have installed the laravel 5 on my local machine.And made the changes in the database.php file in config folder.I have set my credential.Now I am accessing the folder http://localhost/laravel/public/ but it displays html page with this content. Whoops, looks like something went wrong.What configuration should I set apart from this database.php so that it works fine.
This will likely happen to you everytime you create a new Laravel project. The problem is that your webservice (apache/nginx) doesn't have read/write permissions for the storage folder. From the root of your installation perform a chmod 777 -R ./storage and that should get you to the welcome to Laravel screen you should expect for an installation, and from that point on you should now get the error reporting if you have debug mode set as true. If you are still having trouble, you may need to provide access to the ./public folder as well.
You can run laravel application when you have successfully installed in your machine, Add '/public' in url after root folder. Means you have installed app on www.firstlaravel.com and your root folder is 'first'.
So you can run app using like => www.firstlaravel.com/public
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.
Specifically, I'm trying to get ViewGit working on a PHP/Apache/Windows installation.
It seems that PHP is unable to run exec('git');.
exec('whoami'); works just fine, so it isn't a problem with exec() being disabled.
Apache is running under it's own user account- if I log in as this user and attempt to run git on the command line I get the expected results. The account also has full permissions to do everything with the /Program Files/Git folder.
If I run exec('git'); on my local machine it works fine, but just won't work on the server.
Any ideas?
When you type 'git' in command-line on Windows, it opens git.cmd. In typical msysgit installation on Windows, git.cmd is in PATH, but git.exe may not be!
So, you can try one of below:
Create a git.bat in Windows folder with following contents:
C:\Program Files (x86)\Git\bin\git.exe (check path)
Add git's bin directory also in Windows PATH. (You can do so by editing system environmental variables)
I've managed to fix this by upgrading from PHP 5.2 to PHP 5.4. Not sure what the issue was, but that has resolved it.