Laravel not properly config on my Wamp server - laravel

I have installed Laravel 4.2.11 on Wamp server through Composer. I have created the alias using wamp's Apache option but the URL http://localhost/laraveldemo/ (I have created the laraveldemo as alias) shows "Whoops, looks like something went wrong."
How I rectify this?

For further reference, when encountering a problem like this the first step to a solution is enabling the debug flag. That way you can often see a better error message.
This can be done through changing the flag located in app/config/app.php
'debug' => true
Should be set to true.

Related

Laravel on AWS: APP_DEBUG not respected

I initially deployed my Laravel app with APP_DEBUG set to true, but now we're in production I don't want it to whoops! every time there's an error.
I've changed the contents of our EB .config file so that APP_DEBUG: false and I can see the change in Elastic Beanstalk's environment properties:
But Laravel itself is still dumping everything to the screen when there's an error.
I've tried ssh-ing into our server and running php artisan config:clear to see if it was that, but it still didn't work.
I don't understand why Laravel isn't respecting the updated configuration on deployment. Can anyone explain the logic here?
Update: I updated the security settings on the instance and noticed that it was giving our custom error screen. Can anyone explain what happened? Was restarting the server after running php artisan config:clear what did it?
I had issues like this before where I changed something in the console's environment properties which did not correspont with what I got using tinker. You can find the env file on your instance here:
/opt/elasticbeanstalk/deployment/env
if you open the file you see that variables set in .env are not quoted so if you have a password with for example a hashtag or a name with spaces it can result in unintended problems.
I would suggest to stop using environment variables via .yaml config files and start deploying your .env to the elastic beanstalk S3 bucket and fetching it on deployment. This will result in you having more control over the content of the file.
Example of this can be found here:
https://github.com/rennokki/laravel-aws-eb/blob/master/.ebextensions/00_copy_env_file.config

Where is Laravel.log on GAE google cloud platform?

I deployed my laravel application on GCP App Engine
https://MY-PROJECT-NAME.appspot.com/
"Whoops, looks like something went wrong." is displayed.
I want to check a error log. but I couldn't find laravel.log.
Where can I see the log file.
According to the community documentation, you can specify the log-file in your app.yaml file as follows:
env_variables:
# Put production environment variables here.
APP_LOG: errorlog
Regarding the error message, it seems that you may be able to solve it by updating your installer and project with:
composer global update
composer update
You can find more information about that here
The laravel log will be inside your storage directory
storage/logs/laravel.log

CurlExeception with Guzzle using KeenIO

I am building a Laravel (5.1) site which uses KeenIO to do some event tracking. Everything went fine locally (on a mac), so I pushed everything up to my digital ocean droplet through forge to start testing on the server. I delegated the keen events to the Laravel queue service for performance reasons. When I ran the queue:listen command I got this strange error.
[Guzzle\Http\Exception\CurlException]
[curl] 77: error setting certificate verify locations:
CAfile: {my_local_file_path}/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem
CApath: /etc/ssl/certs [url] https://api.keen.io/3.0/projects/{project_id}/events/users
I checked the guzzle source code and it looks like this line is where this path is being set inside of Client.php on line 139.
$opts[CURLOPT_CAINFO] = __DIR__ . '/Resources/cacert.pem';
DIR should be referencing the file path of the server though...so why is it still pointing to my local file path on my mac?????
I tried clearing all the Laravel caches and using every other command I could find. This one has me really stumped, guys. Am I missing something super obvious?
I don't know if this is an actual solution...but after running composer update on my local machine a few times and pushing back up to the droplet, everything seems to be working...If anyone could shed light on why this fixed things I'd appreciate it, haha.

Laravel 4 debugging not working

It's extremely frustrating that I have 'debug' => true in the app config but all Laravel is showing is "Whoops, looks like something went wrong." For the love of coding, does somebody know how to get debugging to work?
I have faced the same problem. Laravel was showing only "Whoops, looks like something went wrong." but this line and not showing the actual error. Then I have checked the app/config/app.php file and changed "debug" => false to "debug" => true and it worked perfectly.
You said that you have also done it and still not working. I suggest you to run a composer update command for your project and then try again.
To be sure your app is in development mode, edit bootstrap/start.php, in the detectEnvironment function simply put your machine name. On linux use hostname terminal commande to determine your machine name.
$env = $app->detectEnvironment(array(
'local' => array('homestead', 'Jeanphi'),
));
Actually debugging is working fine for me with L4.0.7 when i set 'debug' => true in app/config/app.php
That switch tells Laravel to turn on Whoops and to bypass the 'compiled.php' file. When it is disabled, Whoops will not show. A normal server error page is served instead.
Were you expecting something else?
EDIT: maybe you are referring to "debugging" as the old profiler bar that were in L3 (Anbu). In that case I suggest you install this package
Check you haven't renamed your app/config folder as fideloper suggests in the comment.
For example you might have renamed it to prevent overwriting the default config settings when copying your site somewhere else.
For all it's worth, I was getting this error now after deployment because I didn't create these folders:
/app/storage/cache
/app/storage/logs
/app/storage/meta
/app/storage/sessions
/app/storage/views
Some changes need an apache restart to take effect.
I came across problem recently, after separating out debug and a few other config options into a separate (dev.php) config file.
The in-hindsight obvious, by-logic obscure solution: Don't move debug out of config/app.php
Had that same problem altought my app was in debug mode.
In my case I was deploying on server,and to make that work
you must take care of detectEnvironment variable.
It is located in bootstrap/start.php
$env = $app->detectEnvironment(array(
'local' => array('your_server_name'),
));
as it's instructed in the docs :
http://laravel.com/docs/4.2/configuration
i got same problem with that...
first, laravel run well on windows using apache..
then while i'm using ubuntu and nginx, it shows "Whoops, looks like something went wrong."
no error in php log and nothing found on laravel log..
so i tried modify path folder permission to 0777
sudo chmod -R 0777 {put your folder application folder here}
it works
I had the same problem several times and I have two possibilities.
the folder storage doesn't have the right permissions, you should use chmod 755 or chmod 777
the public/index.php has none permission or a 777
These two options has occurred to me before, maybe there are some more.
well you need to clear configuration cache and regenerate it each time you change config files
run 'php artisan config:cache' in console and your good to go

Where does MAMP keep its php.ini?

I have recently got a mac an am not used to developing on a mac at all.
I have MAMP Pro 1.9.6.1. I did a locate on php.ini and got this:
$ locate php.ini
/Applications/MAMP/conf/php5.2/php.ini
/Applications/MAMP/conf/php5.3/php.ini
/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
/private/etc/php.ini.default
I changed the name of all of them. Restarted MAMP. It loaded without a hitch (I know odd right?). I am using PHP version 5.2.
All of these files are now different names (done one by one for process of elimination).
So I figure restart the mac. Same, MAMP loaded no problems, even though all of the php.ini files had been move. On Lamp this that wouldn't even load. But either there is another php.ini file I'm missing (quite possible I don't know how to updatedb), MAMP is really intelligent and just pulls in all of them (less likely) or it doesn't use one.
Note: If this doesn't help, check below for Ricardo Martins' answer.
Create a PHP script with <?php phpinfo() ?> in it, run that from your browser, and look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
I'm not sure if in MAMP (non-PRO) is the same, but MAMP overrides the modified php.ini everytime it starts.
In my case, I needed to use the MAMP menu to change my php.ini file (File -> Edit Template -> PHP -> PHP 5.xx -> php.ini).
To be clearer (as i read this thread but didn't SEE the solution, also if it was here!), I have the same problem and found the cause: I were modifying the wrong php.ini!
Yes, there are 2 php.ini files in MAMP:
Applications/MAMP/conf/php5.5.10/php.ini
Applications/MAMP/bin/php/php5.5.10/conf/php.ini
The right php.ini file is the second: Applications/MAMP/bin/php/php5.5.10/conf/php.ini
To prove this, create a .php file (call it as you like, for example "info.php") and put into it a simple phpinfo()
<?php
echo phpinfo();
Open it in your browser and search for "Loaded Configuration File": mine is "/Applications/MAMP/bin/php/php5.5.10/conf/php.ini"
The error was here; i edited Applications/MAMP/conf/php5.5.10/php.ini but this is the wrong file to modify! Infact, the right php.ini file is the one in the bin directory.
Take care of this so small difference that caused me literally 1 and a half hours of headaches!
The file you have to edit is in MAMP Pro and uses the php.ini file everytime it starts up.
Start MAMP PRO
Edit File > Edit Templates > PHP 5.3.2 php.ini
Restart MAMP Pro
Your changes should stick.
I don't know if you ever found an answer to this but I DIDN'T need MAMP PRO to do this. Simply goto the correct path by following what others have said. It's something like...
MAMP-> bin-> php-> php(your php version)-> conf-> php.ini
The key here is where you're editing the file. I was making the mistake of editing the commented part of the ini file. You actually have to scroll down to LINE #472 where it says "display_errors = Off and change it to On. Hope this helps any
Just run the following command from your terminal, it will show you your Loaded Configuration File easiest way I have ever found.
php --ini
Change /Applications/MAMP/conf/php5.2/php.ini if you are using 5.2 version of php. If you are using the 5.3 php version, edit the /Applications/MAMP/conf/php5.3/php.ini.
If you are using OSX Lion or OSX Mountain Lion, I recommend you using the default installation of apache and php.
Greets!
After running the MAMP server, you have php info link in toolbar
Once click, You will get all information about php
Probably the fastest way to access the PHP.ini for the currently loaded version of PHP in MAMP PRO (v.4.2.1):
Open MAMP Pro
Click on "PHP" under the "Languages" section on the sidebar
Tap on the arrow button right next to the drop-down that lets you select the "Default Version" of PHP.
It depends on which version of PHP your MAMP is using. You can find it out on: /Applications/MAMP/conf/apache/httpd.conf looking for the configured php5_module.
After that, as someone said before, you have to go to the bin folder. There you'll find a conf folder with a php.ini inside.
example: /Applications/MAMP/bin/php/php5.4.10/conf
Leo
After going through all the solutions here, the easiest way to find the loaded php.ini file is to go into phpinfo on the loaded MAMP webpage, which will show you the loaded php.ini file.
This will also confirm if the parameters you change, like max_file_size, have updated correctly.
On my Mac, running MAMP I have a few locations that would be the likely php.ini, so I edited the memory_limit to different values in the 2 suspected files, to test which one effected the actual MAMP PHP INFO page details.
By doing that I was able to determine that this was the correct php.ini:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini
I only have the non-pro version of MAMP but just because it loads it doesn't mean the PHP file is being found/without errors.
I renamed my php.ini files and MAMP still started but Apache returned several errors.
What are you trying to change in your php.ini file?
I have checked all answers and of course I have used phpinfo() to check the exact location of php.ini. I don't see a File option in the menu bar on my mac. I changed both php.ini and php.ini.temp files in that folder. No vail.
Until I realized that I forgot to uncomment the modified always_populate_raw_post_data line.
I was struggling with this too. My changes weren't being reflected in phpInfo. It wasn't until I stopped my servers and then restarted them again that my changes actually took effect.

Resources