stream output of a command continuously run in php - 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.

Related

php files aren't loaded, due to unknown apache errors

I am using apache to run php files in firefox dev edition but some of them won't work.
I guess its because of the following errors that are being shown in console for
apache2: [Mon Dec 18 08:57:59.610192 2017] [mpm_prefork:notice] [pid 121] AH00163: Apache/2.4.28 (Unix) PHP/7.1.7 configured --
resuming normal operations
[Mon Dec 18 08:57:59.610276 2017] [core:notice] [pid 121] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' .
If I click "submit" in my self-made register form, it is supposed to open the next file, which fails:

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.

Switch off output buffering php in lamp

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 <----

Categories