I have a php website using symfony2 framework .I wanted to know what would be the best method to trace incoming request on production server in order to troubleshoot client issues .The only way that i know of is using php log file in C:Windows/Temp directory .Is there any other way of tracing request and troubleshooting error with respect to such request .all the request to website are https not sure fiddler can help me in this scenario .Please let me know your feedback on the same .
Thanks
There are more than on way to log client requests.
First, Apache will log incoming requests in the /var/log/www/access.log
Secondly, Symfony has its own logging enabled by default available in app/logs/prod.log
Thirdly, you can implement client side logging and logging with monolog , example : Javascript errors => send ajax request to log endpoint => log with monolog action
Now, on what type of OS will your site run ? You speak about Windows Temp directory, will your site be hosted on Windows or UNIX servers ? configurations and available tools will then be different.
I am currently working on some project where I plan to do it via GrayLog2 (as #Christophe suggested in a 3rd solution).
I ran some local trials and it seems more than capable of logging just anything.
Related
I'm trying to learn React by replicating a simple CRUD page I created earlier.
The old CRUD page was a Javascript/jQuery front-end with a form. It sent data via AJAX to a PHP backend page, and the PHP page interacted with a mySQL/mariaDB database.
Everything was locally hosted on my PC on XAMPP Apache, and everything worked fine.
I have now managed to replicate the front end using React, via Create React App and it's running on localhost:3000
I am now stuck. I don't know how to make my front-end (on localhost:3000) send data via AJAX to my back-end PHP page (on localhost:80 running on XAMPP Apache)
There are a lot of us PHP / mariaDB types out there who want to continue using that sub-stack as our back-end. The answers to this question will be enormously helpful in encouraging our crowd to try Create React App and React (I'm loving React btw!). (I was surprised that when I searched [create-react-app] [php] in StackOverflow, I got only 2 hits.)
Update: if this is off-topic for SO, then I'd appreciate suggestions on which SE I should post this on... thanks!
Answering my own question.
The basic problem is one of CORS (cross-origin resource sharing). The error one gets is (in the Chrome console):
No 'Access-Control-Allow-Origin' header is present on the requested resource.
During development only, this issue is easily resolved by adding this line of code to the top of the PHP file:
<?php
header("Access-Control-Allow-Origin: *");
This code should never be left there in production unless you're okay with anyone in the world accessing the PHP file API.
In actual production of this React app, one would expect that the JavaScript and the PHP files would share the same domain, so there won't be a CORS issue.
I've been developing a Symfony app (learning Symfony with the goal of replacing an existing "old school" PHP script with it) and am having an issue with putting it "behind" our Shibboleth authentication.
Why do that? For this app I need $_SERVER['REMOTE_USER']. The app doesn't have local accounts, the user doesn't log into the app, but, like many resources, we protect them with some form of authentication.
I have two sites - virtual hosts running on the same physical server. (CentOS 7). The first site has the following in its .htaccess file:
authtype shibboleth
ShibRequestSetting requireSession 1
require valid-user
I have a "phpinfo.php" file in there, too, and can run that script and, after the Shibboleth authentication step, get the output which includes the correct value of REMOTE_USER.
The other virtual host is set up as a Symfony 3.1 app. I've added those three lines to the top of its ".htaccess" file - but after going through the Shibboleth authentication step, the browser gets into a loop and goes no farther. (In Chrome, the 'favicon' is replaced with a looping arrow, and it never stops turning.)
If I hit and then view the source of this still-empty page, I see the following error message:
Error Message: Error decoding authentication request message
I'm not sure how to start to resolve this issue, and was hoping that someone has seen this and knows how to help.
Thanks.
Best,
Stephen
If I understand well, you are trying to make the Service Provider part in Symfony and you already have an IDP working with Shibboleth.
In my case I had also a similar problem and it was because after the Assertion the apache SP was returning to the root URL. I learnt after reading a lot of documentation that if this is not set correctly you can add an attribute in the shibbolet2.xml configuration called homeURL:
<ApplicationDefaults entityID="https://sso/saml2/idp/metadata.php"
REMOTE_USER="mail"
homeURL="https://symfonyApp/redirect/after/login">
Try it out and restart the shib daemon: /etc/init.d/shibd restart
It may be another as well. But it sounds to me that there is some misconfiguration in your SP side.
I'm trying to hoost a website on Microsoft Azure and I did it. But when I enter in my website to a .php page the browser answer with the next error message: "The page cannot be displayed because an internal server error has occurred."
Before that, it returned a 500 error code, but searching the internet I tried to configure de Handler Mappings option (I dont know if I did it good or not, but now that is the new error message).
Is there any required configuration I have to do in order to make .php pages work? I have the "shared" payment plan, Do I need a better payment plan in other to do it?
Thank you!
When I knew there wasnt any extra configuration to run PHP I realized that the only one thing I changed was the Handler Mapping options, so I disabled it and tried with a simple phpinfo() in a index.php .
Exactly, the error was a bad php code. Thank you very much.
NOTE: Other person said me how to get logs for php 500 errors, you can find how to do it HERE.
Ensure that PHP is enabled for you Azure Web App. Go to the Web App in the Azure Portal, click Settings and then Application Settings. There is a dropdown labeled PHP version. Make sure it is not set to "Off" (select your preferred version). Then select Save.
I have an online education site. The site is made up in WordPress and CakePHP 1.3. Recently I have migrated the site to Windows Azure server. Since then i am getting a problem. We have various portals in our site like ops portal, students portal.
All the session scheduling part is taken care of from ops portal. In the ops portal we have a "S Availability" tab that connects to a folder "bes" which is made in core php to schedule the session. Now what is happening is that after every 8- 9 clicks on this tab it starts hanging . It just keeps on processing and when I check the debug window by clicking "Inspect Element" in chrome it keeps on giving pending status to a program "ops_stu_calendar.php".
This "ops_stu_calendar" is the program that connects to "bes" folder and loads the calendar. After processing for a long time sometime it loads the calendar and sometimes I get the error:
"500 Internal Server Error Web server cannot perform this request http://example.com/bes/calendar/ops_stu_calender?id=14996&user_type=ops" .
Also while it is processing on the bottom left of the window it keeps on giving the message "waiting for example.com". Can somebody please explain any reason for this behaviour as it is giving a lot of serious problems in our process.
Gary Liu It is cloud app . My site name in azure is vnayatest.cloudapp.net and the server is windows server 2012 r2
Based on my understanding, cloudapp.net could refer to both Cloud Service and Virtual Machine deployed web application, it would be better if you can let us know what exactly you are using. If you are on a virtual machine deployment, in this case standard PHP troubleshooting tips apply, please make sure you are writing the logs, i.e. http://php.net/manual/en/function.error-log.php, the server logs could also help us to further troubleshoot the root cause. Additionally, this thread may provides some insights about troubleshooting hangs: How to find out what makes my PHP application to hang the Apache server?, please check it and see if it helps.
AFter processing for a long time sometime it loads the calendar and sometimes i get the error "500 Internal Server Error Web server cannot perform this request http://example.com/bes/calendar/ops_stu_calender?id=14996&user_type=ops" .
If you are using Wordpress's All-in-One Event Calendar, it looks like there are some known browser compatibility issues: https://wordpress.org/support/topic/calendar-hangs-no-response-from-any-on-page-functions
I've been developing a site for a client that uses the Tweetr API to post messages to a user's Twitter account. It has now been discovered that the destination server is running IIS, so no mod_rewrite for the Tweetr proxy. Also cURL is not available, which prevents the proxy from forwarding requests.
The lack of mod_rewrite can be got around, but I need an alternative to using cURL that doesn't require anything not included in a very basic PHP 5.2 install. I'm considering trying to recreate the proxy functionality with jQuery AJAX, but at the same time that seems like a very lengthy solution. Can anyone point me in the right direction here?
I think that this might be what you're looking for.