Switch off output buffering php in lamp - php

I want a way to turn off my output buffering. I tried flush() and ob functions but didn’t succeeded. In my etc/php5/apache2/php.ini value of output_buffering = 4096.
When I change it to Off and restart Apache it fails to restart.
error in log file is:
[Sat May 31 15:48:26.853420 2014] [mpm_prefork:notice] [pid 1277] AH00169: caught SIGTERM, shutting down
[Sat May 31 17:23:30.461926 2014] [mpm_prefork:notice] [pid 1270] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming normal operations
[Sat May 31 17:23:30.484232 2014] [core:notice] [pid 1270] AH00094: Command line: '/usr/sbin/apache2'

it's not running. you disregard phpmyadmin. look up /etc/apache2/httpd.conf it's the wrong file or hosed. it might be in /user/local/etc/ you can check your settings with $ httpd -v.
also read this page.
http://httpd.apache.org/docs/2.2/programs/httpd.html
notice the -e option <----

Related

Apache error - PHP configured - resuming normal operations [MAC]

I've reinstalled apache and php using brew a few times and have gotten no where.
Currently my error log keeps showing:
[Sun Jan 10 22:40:01.548345 2016] [mpm_prefork:notice] [pid 35970] AH00173: SIGHUP received. Attempting to restart
[Sun Jan 10 22:40:01.578572 2016] [mpm_prefork:notice] [pid 35970] AH00163: Apache/2.4.16 (Unix) PHP/7.0.2 configured -- resuming normal operations
[Sun Jan 10 22:40:01.578609 2016] [core:notice] [pid 35970] AH00094: Command line: '/usr/local/Cellar/httpd24/2.4.16/bin/httpd'
My localhost server is working fine and displays the 'It Works!!!' page.
However, when I try to load a standard phpinfo page, it just displays the code. I'm guessing that's happening because of the errors above, so any suggestions to fix this ?

Code Igniter blank page with no error display even though display errors are on

I am using CodeIgniter 2.1.4 version. My production server environment is "PHP Version 5.5.26-1+deb.sury.org~precise+1", Apache, Ubuntun.
Display error is on server wide. I've turned it on from the index.php like following code as well
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
ini_set('display_errors', 1);
break;
case 'testing':
case 'production':
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
ini_set('display_errors', 1);
break;
default:
exit('The application environment is not set correctly.');
}
}
Apache error.log
[Thu Jul 09 06:25:10.623268 2015] [mpm_prefork:notice] [pid 5000] AH00163: Apache/2.4.12 (Ubuntu) OpenSSL/1.0.1 configured -- resuming normal operations
[Thu Jul 09 06:25:10.623313 2015] [core:notice] [pid 5000] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 09 11:18:37.211428 2015] [mpm_prefork:notice] [pid 5000] AH00169: caught SIGTERM, shutting down
[Thu Jul 09 11:18:38.742472 2015] [mpm_prefork:notice] [pid 29818] AH00163: Apache/2.4.12 (Ubuntu) OpenSSL/1.0.1 configured -- resuming normal operations
[Thu Jul 09 11:18:38.742552 2015] [core:notice] [pid 29818] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 09 12:11:37.699200 2015] [mpm_prefork:notice] [pid 29818] AH00169: caught SIGTERM, shutting down
[Thu Jul 09 12:11:38.517693 2015] [mpm_prefork:notice] [pid 3072] AH00163: Apache/2.4.12 (Ubuntu) OpenSSL/1.0.1 configured -- resuming normal operations
[Thu Jul 09 12:11:38.517797 2015] [core:notice] [pid 3072] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jul 09 12:19:15.599384 2015] [mpm_prefork:notice] [pid 3072] AH00169: caught SIGTERM, shutting down
[Thu Jul 09 12:19:16.423490 2015] [mpm_prefork:notice] [pid 3819] AH00163: Apache/2.4.12 (Ubuntu) OpenSSL/1.0.1 configured -- resuming normal operations
[Thu Jul 09 12:19:16.423584 2015] [core:notice] [pid 3819] AH00094: Command line: '/usr/sbin/apache2'
Except this, there's nothing in there. And I don't think it's related.
But no errors were shown and totally blank page. It's running fine on other production server environment as well as localhost.
What should I check and how should I resolve it?
Thank you.
Looking through the comments on the question, this appears to be a permissions issue, as the folder (and possibly/probably) the files within are assigned to user root and group root.
You'll need to allow Apache to access the files and folders in order to get it running. There's two ways of doing this:
Set the user and/or group to be www-data by running sudo chown -R www-data:www-data /path/to/codeigniter' (for user and group), or remove the :www-data part for only setting the user, or use :www-data to only set the group. If the group is set, you'll need to make sure the group has read and write access to the folders and files (sudo chmod g+rw /path/to/codeigniter`).
Note: this is not the best way as it can open up all kinds of security issues set the permissions to the file and folder structure to be 777 (everyone can read, write and execute) by doing sudo chmod -r 0777 /path/to/codeigniter
check error log by ssh tail command like
tail -f /var/log/httpd/error.log
here you can go to httpd folder and then ls and see what exact name of error log and then use tail command to view that log file.
to go to httpd folder just write cd /var/log/httpd and then ls to check error_log file name.

caught SIGTERM error PHP FAST-CGI APACHE Ubuntu14.4

I installed PHP 5.2.17 as per the following tutorial
http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204
apt-get installed PHP5.5 and apache 2.4.7
PHPINFO reports that the php version of the set host is still 5.5.9
when I restart apache2 service, I get the following in error.log.
[Thu Mar 19 14:18:53.648697 2015] [mpm_prefork:notice] [pid 23518] AH00169: caught SIGTERM, shutting down
[Thu Mar 19 14:18:54.741836 2015] [:notice] [pid 5543] FastCGI: process manager initialized (pid 5543)
[Thu Mar 19 14:18:54.754243 2015] [mpm_prefork:notice] [pid 5541] AH00163: Apache/2.4.7 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 PHP/5.5.9-1ubuntu4.6 configured -- resuming normal operations
[Thu Mar 19 14:18:54.754317 2015] [core:notice] [pid 5541] AH00094: Command line: '/usr/sbin/apache2'
Removing php5.5 solved the problem.
The problem probably was a conflict between the two PHP versions, using same fastcgi implementation.

Getting Blank screen and nothing in logs. Is this Php syntax and Apache issue?

I am getting the blank screen. No errors in the Apache logs, nothing.
I was thinking there may be a php syntax error and it quietly dies, but I have configured php.ini to display errors:
display_errors=On
html_errors=On
error_reporting=E_ALL | E_STRICT
display_startup_errors=On
here are relevant php configurations loaded:
display_errors On On
display_startup_errors On
enable_dl Off Off
enable_post_data_reading On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 22527
Why is there no Apache error logs? How to trace Apache execution? any help is much appreciated. Thank you
Update:
I was wrong, Apache writes log only once on restart at the time of restart at the location specified by ErrorLog in the Apache Configuration, but nothing is written afterwards even when I get the blank site. Here logs from ErrorLog:
[Tue Nov 18 17:08:20.372970 2014] [mpm_prefork:notice] [pid 1601] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:08:20.376988 2014] [mpm_prefork:info] [pid 1601] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:08:20.377699 2014] [core:notice] [pid 1601] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 18 17:19:32.301203 2014] [mpm_prefork:notice] [pid 1643] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:19:32.313839 2014] [mpm_prefork:info] [pid 1643] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:19:32.314481 2014] [core:notice] [pid 1643] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 18 17:50:22.848631 2014] [core:info] [pid 1643] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=1643)
[Tue Nov 18 17:50:22.848631 2014] [mpm_prefork:notice] [pid 1643] AH00169: caught SIGTERM, shutting down
[Tue Nov 18 17:50:25.288368 2014] [mpm_prefork:notice] [pid 3313] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.4 configured -- resuming normal operations
[Tue Nov 18 17:50:25.290696 2014] [mpm_prefork:info] [pid 3313] AH00164: Server built: Jul 22 2014 14:36:39
[Tue Nov 18 17:50:25.291613 2014] [core:notice] [pid 3313] AH00094: Command line: '/usr/sbin/apache2'
How to make Apache log for PHP errors or anything for that matter to be able troubleshoot issues?
It turns out this was neither Apache nor PHP error, but an application level issue where there is ErrorHandler function declared that does hide all the php errors as described here:
PHP's white screen of death
I came to conclusion to the fact that it is neither Apache nor PHP configurations by changing ErrorLevel to trace8 in virtual host settings:
LogLevel trace8
ErrorLog ${APACHE_LOG_DIR}/dev-virtual/error.log
Afterwards, I tail the logs specified in ErrorLog from command line and make requests. The logs showed:
[Tue Nov 18 18:16:37.398720 2014] [http:trace3] [pid 4054] http_filters.c(977): [client 10.88.12.0:49378] Response sent with status 200, headers:
...
[Tue Nov 18 18:16:37.399243 2014] [http:trace4] [pid 4054] http_filters.c(806): [client 10.88.12.0:49378] Content-Length: 0
...
Here, the logs shows 200 response with Content-Length:0. The 200 is good response from Apache, so its not Apache error responsible for the blank page. Seeing the Content-Lenght set to 0, made me think there is something more than PHP setup/configuration issue. It was the ErrorHandler at the Application level.

stream output of a command continuously run in php

i am running this simple command { ./a.out < in; } &> output.txt using exec and i want to output what's coming in output.txt through ajax request continuously. Also i want a way to turn off my output buffering.I tried flush() and ob functions but didn't succedded.In my /etc/php5/apache2/php.ini php.ini value of output_buffering = 4096
error in log file is:
[Sat May 31 15:48:26.853420 2014] [mpm_prefork:notice] [pid 1277] AH00169: caught SIGTERM, shutting down
[Sat May 31 17:23:30.461926 2014] [mpm_prefork:notice] [pid 1270] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming normal operations
[Sat May 31 17:23:30.484232 2014] [core:notice] [pid 1270] AH00094: Command line: '/usr/sbin/apache2'
.When I change it to Off and restart my apache2 server it fails to restart.P.S. I am using lamp server.

Categories