PHP Error Logs on IIS 7.5/Windows Server 2008 - php

I'm confused about where I should be looking for a log file containing php errors on a Windows 2008 Server running IIS 7.5 (I'm more familiar with the Mac OS X setup for this).
In my php.ini file I have log_errors set to "On" but I'm not seeing any php errors in the IIS logs that appear in this folder:
C\inetpub\logs\LogFiles
Is it possible to have the php errors included in this file or do I need to specify a new file just for php errors?
(I'm trying to troubleshoot a site that is generating 500 – Internal server error for a php error. I've found this site http://www.webdigi.co.uk/blog/2009/php-on-windows-server-2008-500-internal-server-error-on-iis/ that explains how I can view the error when accessing the page via an RDP session on the server, but I need to be able to log these and view the log as I won't always have RDP access).

In the php.ini (you can find this under "c:\program files (x86)\php\{PHP Version}") change these settings:
log_errors = On
Then set error_log to syslog for the windows event log:
error_log = syslog
Or specify a location on disk such as:
error_log = C:\Windows\temp\php_errors.log
Make sure that the error_log or log_error values aren't being set elsewhere in the file.

If you are using xampp in windows. The error log can be find in
cd C:\xampp\apache\logs\
Use the following command to display the latest errors
tail -f .\error.log

Related

PHP Error logging on Apache HTTPD on Windows: What is wrong with this configuration that it is not logging errors?

I am getting a blank screen and nothing in the error logs for a php program I am trying to get up and running (it happens to be yourls). What do I need to do to get error logging enabled or to otherwise get an indicate of why the page is not loading (I know there are multiple postings on this but none of the fixes suggested in this posts seems to generate any output and don't seem to work for this specific implementation)?
I'm running php from this install: php-8.0.0-nts-Win32-vs16-x64.zip
I'm running Apache HTTPD from this install: httpd-2.4.46-o111i-x64-vc15.zip
Turns out this was a behavior of the yourls software I was trying to run. It had a flag that turned error logging/messaging off AND it was not compatable with php 8. I switched to php 7 and switched to the php.ini-development config (by renaming it to php.ini) and I am now seeing error messages (the driver for the database is missing).

bigquery php client not working with Apache web page (Ubuntu 18.10 server)

I have a working Apache 2.4 website that works with Php 7 pages, on an Ubuntu 18.10 server.
My example is based on:
https://cloud.google.com/bigquery/docs/quickstarts/quickstart-client-libraries#client-libraries-install-php
When I run the page as me from the command line
php filex.php
bigquery works and I can see the data.
When I try and view it from the apache web server the 1st part of the page renders then there is an error and the bigquery part is missing.
Error in /var/log/apache2
PHP fatal error Uncaught Google Cloud Exception
I guessed it was a permissions issue with Apache vs my userid.
I thought Apache might be having difficulty accessing the Bigquery php client files, due to directory permissions.
However, the problem was I had not set the environment variable correctly.
I had looked here:
https://help.ubuntu.com/community/EnvironmentVariables
and set System-wide environment variables
/etc/environment
GOOGLE_APPLICATION_CREDENTIALS="/bigquery/project1/accountdetails-xxxxxxxxxxxx.json"
It was visible when logged in as userx
echo $GOOGLE_APPLICATION_CREDENTIALS
Then I came across
https://medium.com/#william.b/setting-dynamic-environmental-variables-in-apache-from-the-os-1d5c1e2e9e6c
which gave me the solution
nano /etc/apache2/envvars
I added the line to the bottom of the (mainly empty) script
export GOOGLE_APPLICATION_CREDENTIALS="/bigquery/project1/accountdetails-xxxxxxxxxxxx.json"
I restarted the server.
Now the web page works as expected.
===================
Nginx
nginx also needs to be configured to work (Ubuntu 18.10, nginx 1.14.)
from
https://medium.com/#tomahock/passing-system-environment-variables-to-php-fpm-when-using-nginx-a70045370fad
/etc/php/7.2/fpm/pool.d$
edited www.conf
uncomment
;clear_env = no
added line
env[GOOGLE_APPLICATION_CREDENTIALS] = /bigquery/project1/accountdetails-xxxxxxxxxxxx.json
restarted nginx and it worked.

PHP mongoDB Driver MongoDB\Driver\Manager hangs

I have a problem accessing a mongoDB database using the PHP driver.
When I locally run the following code:
<?php
echo "Connecting";
$manager = new MongoDB\Driver\Manager("mongodb://localhost:28124");
echo "Connected";
?>
it works.
However, when I access this php file remotely from the browser, I only see "Connecting" and then the web page hangs with internal server error 500.
I'm running with:
PHP 5.6.25 (cli)
MongoDB: 1.1.8
Apache: 2.2.22
Any ideas?!?!?!?
There is no way of tracing the problem without logs.
Please check your default log, which should be in "/var/log/httpd/error_log" or "/var/log/apache2/error.log" (custom logs might not get all the info) and provide specifics.
If you are not getting anything from the logs, please retry after turning PHP logging on.
In php.ini(of apache dir):
Remove semicolon from in front of below lines
;display_errors
;display_startup_errors
;error_reporting
Set the values to
display_errors = On
display_startup_errors = On
error_reporting = E_ALL
Restart the server, run script, on error, check the logs again.
Note: Reset the php.ini to default values after you are done. Error logging adds significant overhead to execution.

Setting up web application on Ubuntu Server 12.04 results in Internal Server Error

I have an existing web application (currently working on Windows 7). I set up a box with Ubuntu Server 12.04 that I wish to host/test my application on. Problem is, when I try to access the app I get an 500 Internal Server Error.
To be sure there is something wrong with the app itself (as opposed to Ubuntu and Apache configurations) I set up a test domain on the Ubuntu Server which I can access from my windows computer without a problem. I then ftp'd the app to this folder.
This app is using Code Igniter. I have changed the config file to reflect any changes that may affect names/paths. I have a database that is set up correctly. Have I forgotten to change anything else that would cause this error when transferring from Windows to Ubuntu?
edit: As suggested by Steve V here is a message I get in my error log when trying to access the site.
[alert] [client xxx.xxx.x.x] THEPATH/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Your rewrite engine isn't enabled.
Go to shell and do the following:
a2enmod rewrite
service apache2 restart

cURL with Terminal for AWS Ec2

So I just switched from some network solutions hosting running some php files that return JSON. when I run the same curl terminal command to the new server it does not respond the php errors like it did before. What do I need to do to enable it so it returns the errors in the terminal with curl?
Update it appears it's returning a HTTP Error 500. How can I show the errors instead?
I figured it out, i edited /etc/php.ini to display_errors = On;

Categories