New to Laravel, coming from Rails. In Rails you start the server via rails serve and then begin seeing the server logs (http requests, db queries, etc). How do I see this in Laravel? I'm using Valet so I don't have to run any command to start the server.
The server logs, depend on your valet configuration,
See: Laravel Valet logs
However i think you are looking for the laravel logs, that catch most errors, before sending them to the actual server logs
You'll find these at ./storage/logs in your project. If you didn't set up any different logging method.
Related
I want to start deploying my laravel app to production. To avoid changing AWS config in the near future, I decided to try to add continuous integration. To do this I'm using elastic beanstalk and pushing the code there using another AWS tool. All this is working perfectly. I put a test message in /public/index.php to output "hello world" and it works as expected when going to the URL. When I remove this text and run my laravel app as normal, I get a 500 internal server error. I'm not sure all what elastic beanstalk does on deployment for laravel apps. Because of this I'm not sure if this error is occurring from a bad DB connection or laravel app not fully setup yet.
I created an RDS DB instance outside of elastic beanstalk. I am able to access this from sequel pro and I added the database I will use to store all my data. I added all the necessary db connection values (host, port, database, username, password) to /config/database.php and the elastic beanstalk server configuration environment variables.
I've searched online for days for info but haven't found anything specific to this. Also part of my issue is a lack of understanding of how laravel is setup during a deployment in beanstalk. Is there something with /.ebextensions that will help me accomplish these goals?
When I deploy my code I need to make sure all vendor files are installed through composer and then I also need to make sure all database migrations/changes happen. I want to automate as many steps as possible so I can just push up code changes and server will change code and keep working.
I also want to make sure there isn't anything I'm missing for setting up my db connection. Are there any other files in laravel I need to setup or something in elastic beanstalk I need to have configured? I'm keeping my db open to all connections and then I can tighten restrictions later
EDIT: My database may not be configured correctly yet, but that appers to not be source of the issue. I think my issue is knowing what scripts and how to run them during deployment. I want to make sure composer and php artisan migrate is ran to keep everything up to date. How can I do this with elastic beanstalk?
This is a little off topic but with my experience I do not recommend using beanstalk to achieve a good workflow pushing and deploying. I recommend
you to use Forgelaravel.com to deploy your GitHub repository. In forge Laravel you will be able to create a server from AWS and it will automatically create database connections and stuffs, then with just one click you can deploy to the server and keep a good workflow.
Given that we're speaking of a Laravel application, this 500 Server Error
often occurs when one is creating new infrastructure. Why? It's likely to forget to add the environment variables to the EB environment.
Simply go to that EB environment configuration, then under software modify to include at least the following environment properties
APP_DEBUG (can be, for example, false)
APP_KEY (this is the key generated with php artisan key:generate)
APP_NAME (tiagoPeres)
Then the issue will be gone.
I am working on plesk php api. I am adding subscription. There is no problem in this actions. When I was calling multiple query at the same time. Second query is make unsuccessful. Server sending 502 gateway error. I think; plesk api dont process multiple task. I want to make hosting creator. My customers will create own hosting on my customer panel. So I need multiple process at the same time. How i solve this problem ?
Let me assume that you are sending an API request from PHP application located on the same server.
During the subscription creation, Plesk creates new configuration files for web services and reloading these services to apply the new configuration. As a result, PHP application fails whilst, for example, Apache is being restarted at the moment.
As half-measures, you may consider setting Apache restart interval in Tools & Settings > Apache Web Server or enabling graceful restart for Apache.
The best and the right way, of course, is to use a separate hosting to send API queries.
We're hosting a php website on Azure App Service.
Sometimes it is down and displays this error:
"Has Encountered an Error String Match Failed. String Not Found"
After restarting the App Service it works again. I'm quite sure it has nothing to do with the PHP part of it. Unfortunately I wasn't able to find anything helpful.
Why does it happen and how can we fix it?
Here is what MS Support wrote
The application site content is hosted within Web App Azure App Services are backed by Azure Storage in a durable manner. The application accesses the site contents as file shares to allow for application compatibility and availability. Unfortunately, there have been a few cases in which sites are unable to access their content, due to storage being unavailable via our file servers. The causes for this may include transient storage/network availability blips, file server maintenance (rebooting/OS patching) or even crashes.
Possible "fixes":
Use the Local cache feature.
Upgrade the service plan to premium V2, it is using SSD storage, and have faster speed to read and write.
Using VM to host website.
Ensure Always-on feature is ON and that PHP version is correctly set on the Portal.
Try enabling logging. To do this:
Use Kudu Console and go into D:\home\site\wwwroot
In your .user.ini file, add the following line (you can type touch .user.ini to create the file if it doesn't exist, and don't forget the starting dot on the .user.ini file!):
log_errors = On
Restart your site
Make a few failing requests to get some logging going.
Now, from Kudu Console, go to D:\home\LogFiles and open up (or download) php_errors.log.
At the end, you'll find the most recent entries, which may give clues as to what's going on.
Reference:https://github.com/projectkudu/kudu/wiki/Troubleshooting-PHP-errors
I'd like to run a script (phantomJS) via php exec() or shell_exec(). Everything is working fine on my development system.
I've installed phantomJS on my production server, and have run it successfully from the terminal after logging in via SSH.
But when I run it from PHP via exec() or shell_exec(), I get messages saying:
GLIBCXX_3.xx not found
GLIBC_2.xx not found
The support team at the web hosting provider is saying they don't know how to enable the server to access the script and still maintain security:
We're not familiar with the specifics of it, so we'll either have to
go through with disabling the chroot, but as our supervisor mentioned
this will allow all accounts on the server to account with each other
which is what the chroot prevents.
You can have your own system administrators look at the setup as you
do have root access, and see if they can devise a workaround, but on
our end this is the only thing we can suggest.
They are running CentOS, which is a 64-bit Linux OS.
I have very good experience with this web host up to this time, so I'm hoping there's a way to address this without changing hosts.
I have full root access to the account, so I can configure it in any way necessary.
Can anyone make some suggestions about how I might configure my production server to access phantomJS while maintaining a secure server?
UPDATE
Apparently my app is in a "chrooted environment" without full root access to GLIB on the server. The web host is saying there will be a lack of security if my php user is given full root access.
You have to remove your PhantomJS system call and create an API layer or a service that subscribes an MQ queue and then integrate it with PHP to avoid several problems, including the chroot limitation.
I'm currently writing a php API returning a JSON array. On my development environment everything seems to work fine.
So it was time for us to upload it on our dedicated server. But here is the deal. While our code is perfectly working on most environments, it is not on our server.
As I'm not an expert on multi-domain sites, we decided to try cPanel WHM, to easily configure our web server. Everything seems to work well, our API default page is running perfectly, showing the correct responses when a user is not permitted. As we are using custom urls, our .htaccess seems to work as well. But here is the rub! When I'm entering a $_GET variable to enter the API by using the correct keys, the server is automatically responding a 500 internal error.
I tried to look at the apache log file, it shows a
AH02812: attempt to invoke directory as script
I directly understood it was a httpd.conf problem. I replaced ScriptAlias by Alias, as most topics were saying. Now I don't have this error on my log, but its still showing the 500 internal server error.
We are currently running on Debian 7, with the latest stable version of cPanel. Our PHP version is 5.6.