httpd.conf page (and others) now blank after updating PHP - php

I am in a beginning PHP/SQL coding class at school. They have us following the Lynda.com videos for help but they don't answer specific questions. I tried to update the PHP per the instructions, then I got this:
Restarting Apache
[Thu Feb 08 21:25:55.945052 2018] [so:warn] [pid 1936] AH01574: module php7_module is already loaded, skipping
Syntax OK
Finished.
I tried to go into sudo nano httpd.conf to maybe disable the other version but when I went into that page it was now blank (it was not blank before trying to update PHP). Now my teacher cannot help as he does not work on a MAC and I cannot figure out how to reverse the update so that I can just use what my computer already had. Almost every page I try to go into is blank now.
Please help me, I was just following instructions :(
PS there was this at the beginning of the installation so I'm not sure if it means anything:
MacBook-Pro:Sites Mizgr33n3y3z$ curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2
[WARNING]
Detected macOS High Sierra 10.13. As this is quite new, there may be issues still. Your mileage may vary.

Related

"End of script output before headers" on CentOS, but working on other LAMP stacks

I've set up a Centos 6 + CPanel 11 VPS, and everything is as it was out of the box. I've installed Phorum 5.2.20 in the public_html directory, but Phorum is causing an error 500. The error log reports:
[Mon Jul 27 11:21:57.770447 2015] [core:error] [pid 14342] [client x.x.x.x:42531] End of script output before headers: admin.php
The code works fine on my Debian LAMP server (and several other non-Centos/CPanel LAMP stacks I've used to test this), and Wordpress and some other stuff runs fine on the CentOS machine.
I've tried other code too, and it works on my other servers, but doesn't work on CentOS. Phorum is the only code that matters, so I made question focuses on that. I'm also reluctant to edit the core files of Phorum.
Any ideas?
Fixed: Permission Issue
I have also faced the same issue after installing fresh installation on VPS, later I found It's a permission issue, Directory should be 755 and files should be 644 then only it works.
sudo chmod -R 755 projectfolder
sudo chmod -R 644 index.php //projectfiles
I think there is an issues with the php handler. Can you please try to change your php handler through WHM >>Service Configuration >> Configure PHP and suEXEC and check your URL again.
For me the error was caused by file permissions. Luckily it was just the one file causing it so I used the same permissions as the working .php files and it worked.
In my case 644 worked with enough permission to run and not too much to trip the security settings.
I had same error for more than a day finally i found out that accidentally my /home/mysite_username/fcgi-bin/php7.0.fcgi file owner and group was changed to root. Restoring owner to mysite_username solved this issue. (I'm using Virtualmin)
Fix permissions from User Account Menu of CWP.

Apache Server Throwing 500 Internal Server Error

I had a LAMP application running wordpress and I deleted the whole directory and replaced with new files - php based.
Now, when I go to view my server running CentOS - it just shows a 500 Internal Server error.
I've tried:
restarting server
restarting apache service itself
both completed successfully, but this didn't fix anything. Now, I do not know where to go from here.
apache logs # /usr/local/apache/logs/error_log on apache:
[Tue Apr 22 11:12:15 2014] [error] [] SoftException in Application.cpp:357: UID of script "index.php" is smaller than min_uid
I found the fix myself, this wasn't an error with Mysql at all, but rather a permissions issue with the index.php file I had.
The error, which I found in /usr/local/apache/logs/error_log was:
:is smaller than min_uid Premature end of script headers: index.php
To fix, I did this:
ls -l in the directory causing the issue (mine was public_html)
You should see the index file (e.g. index.php) that should be causing the issue. It is due to a root user having the only permission to the file and not your CPanel (or system) username. (note this system/cpanel name)
Run the following within the errorneous directory(Note: this command must be run within all subdirectories of the primary errorneous directory.):
sudo chown yoursystemuserhere:yoursystemgroupuserhere index.php
or to apply to the whole directory (thanks to #Prix):
sudo chown -R user:group /folder
You're all set.
Further literature here: http://www.inmotionhosting.com/support/website/general-server-setup/uid-smaller-than-min-uid
I hope this helps someone else in the future.
I had similar symptoms on my cPanel VPS - I was able to use easyApache to recompile Apache and PHP which fixed the problem for me.
(I realise my problem was slightly different to yours, but it may be helpful for people in the future who have the same problem I had).
chown -R user.usergroup /path_to_the_directory
Will resolve this. It is basically permission issues.
just install wordpress latest version make sure you have atleast php version 5.3 and above also look global register variable if it off or just delete htacess file from server and see what will happens
generally 500 internal server gives when file permission is missing so you should delete htacess file

Apache2 throwing 500 error for php files. log shows Premature end of script headers

I'm on a relatively fresh install of Ubuntu and this is the first time I've used the local web server on it.
The problem I have is that when I try and access a php file I get a 500 error.
To try and solve it I've:
Renamed index.html to index.php in /var/www to make sure it's not a virtualhost error (standard "it works" file)
given 0777 permissions to both /var/www and the index.php file
made www-data the owner of the directory and the file
made www-data the group for the directory and the file
checked the error log
trawled Google
The error log shows:
[Sat Sep 07 13:18:56 2013] [notice] Apache/2.2.22 (Ubuntu)
PHP/5.4.9-4ubuntu2.3 configured -- resuming normal operations
which I understand means the PHP is loading correctly
The only entry I do not understand is
[Sat Sep 07 13:19:00 2013] [error] [client 127.0.0.1] Premature end of
script headers: index.php
I've done searches but most of the articles I've found are no help.
Is there anything else I can do to try to debug the error or does anybody have any ideas as to why this error is happening?
Thanks in advance,
Is error reporting on in php?
try adding:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
on the first line of the script after
First of all thanks for VIVEK-MDU for the suggestions and changes to my post. I must admit that I thought the lists were done automatically (I never got into markdown (just seen I missed the space before the minus sign on the list items)).
Answer?
Unfortunately I cannot help anybody who lands at this page with a similar problem.
I also develop on my laptop which has a similar setup. after copying:
/etc/apache2/
/etc/hosts
/var/www - the correct permissions for my system are my-user (not root or www-data)
The system now works as expected. Again: sorry I can't help anybody else but thanks to everyone who looked and the people that helped.
John

Connection reset by peer: mod_fcgid: error reading data from FastCGI server

I am having issue on PHP where my app is trying to run a php backup file and suddenly getting HTTP Error 500 Code. I have checked the logs and this what it saying.
[Tue Aug 28 14:17:28 2012] [warn] [client x.x.x.x] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://example.com/backup/backup.php
[Tue Aug 28 14:17:28 2012] [error] [client x.x.x.x] Premature end of script headers: backup.php, referer: http://example.com/backup/backup.php
Anyone knows how to fix this? I'm really stuck in here and can't find solution in internet.
Hope anyone could share their knowledge.
Thanks.
James
I managed to solved this by adding FcgidBusyTimeout . Just in case if anyone have similar issue with me.
Here is my settings on my apache.conf:
<VirtualHost *:80>
.......
<IfModule mod_fcgid.c>
FcgidBusyTimeout 3600
</IfModule>
</VirtualHost>
I had very similar errors in the Apache2 log files:
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: phpinfo.php
After checking the wrapper scripts and Apache2 settings, I realized that /var/www/ did not have accordant permissions. Thus the FCGId Wrapper scripts could not be read at all.
ls -la /var/www
drwxrws--- 5 www-data www-data 4096 Oct 7 11:17 .
For my scenario chmod -o+rx /var/www was required of course, since the used SuExec users are not member of www-data user group - and they should not be member for security reasons of course.
if you want to install a PHP version < 5.3.0, you must replace
--enable-cgi
with:
--enable-fastcgi
in your ./configure statement, excerpt from the php.net doc:
--enable-fastcgi
If this is enabled, the CGI module will be built with support for FastCGI also. Available since PHP 4.3.0
As of PHP 5.3.0 this argument no longer exists and is enabled by --enable-cgi instead. After the compilation the ./php-cgi -v should look like this:
PHP 5.2.17 (cgi-fcgi) (built: Jul 9 2013 18:28:12)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
NOTICE THE (cgi-fcgi)
I had this issue and realized that the file cgi-bin/php-fcgi had no execution rights.
It had 644 mode while is should have 755 mode.
Setting the correct mode was impossible (probably because the file was opened or sth), so I copied that file from another domain directory where it had proper rights already set and that fixed everything.
I had the same problem with a different and simple solution.
Problem
I installed PHP 5.6 following the accepted answer to this question on Ask Ubuntu.
After using Virtualmin to switch a particular virtual server from PHP 5.5 to PHP 5.6, I received a 500 Internal Server Error and had the same entries in the apache error log:
[Tue Jul 03 16:15:22.131051 2018] [fcgid:warn] [pid 24262] (104)Connection reset by peer: [client 10.20.30.40:23700] mod_fcgid: error reading data from FastCGI server
[Tue Jul 03 16:15:22.131101 2018] [core:error] [pid 24262] [client 10.20.30.40:23700] End of script output before headers: index.php
Cause
Simple: I didn't install the php5.6-cgi packet.
Fix
Installing the packet and reloading apache solved the problem:
sudo apt-get install php5.6-cgi if you are using PHP 5.6
sudo apt-get install php5-cgi if you are using a different PHP 5 version
sudo apt-get install php7.0-cgi if you are using PHP 7
Then use service apache2 reload to apply the configuration.
The famous Moodle "replace.php" script can generate this situation too.
For me it was taking ages to run and then failed with a 500 message in the browser and also with the above error message in my apache error log file.
I followed up on #james-wise answer:
FcgidBusy is readably described in the Apache documentation. I tried this: doubled the amount of time which apache would give my script to run, by inserting the following line in /etc/apache2/mods-available/fcgid.conf
FcgidBusyTimeout 600
Then I restarted Apache and tried to run my replace.php script again.
Fortunately this time the script instance ran to completion, so for my purposes this served as a solution.
I came across this one while debugging a virtualmin/apache related error.
In my case, I am running virtualmin and had in my virtual machine's php.ini
safe_mode=On.
In my Virtual Machine's error log, I was getting the fcgi Connection reset by peer: mod_fcgid: error reading data from FastCGI server
In my main apache error log I was getting:
PHP Fatal error: Directive 'safe_mode' is no longer available in PHP in Unknown on line 0
In my case, I simply set safe_mode = Off in my php.ini and restarted apache.
stackoverflow.com/questions/18683177/where-to-start-with-deprecated-directive-safe-mode-on-line-0-in-apache-error
Not in this questions askers case but often:
What does the "premature end of script headers" error mean?
That error means that the FCGI call was exited unexpectedly.
In some cases it means that the script "backup.php" did crash.
How to fix this?
If the crash of a script was the cause, fix the script so that it does not crash. Then this error is fixed, too. To find out if and why a script crashes, you need to debug it. For example you can check the PHP error log. Errors logged to STDERR normally go into the error handler of the FCGI.
I had the same problem with long-running scripts with the error messages
"Premature end of script headers: index.php" and "Connection reset by peer: mod_fcgid: error reading data from FastCGI server" in error_log.
After hours of testing this helps for me (CentOS 6, PHP-FPM 7, Plesk 12.5.30):
edit the config file:
/etc/httpd/conf.d/fcgid.conf
Set a higher running time. In my case 600 seconds
create the new entry:
FcgidBusyTimeout 600
adapt following entries:
FcgidIOTimeout 600
FcgidConnectTimeout 600
restart httpd:
service httpd restart
In CentOS releases suexec is compiled to run only in /var/www. If you try to set a DocumentRoot somewhere else you have to recompile it - the error in apache log are:
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: php5.fcgi
Just install php5-cgi
in debian
sudo apt-get install php5-cgi
in Centos
sudo yum install php5-cgi
Check /var/lib/php/session and its permissions. This dir should be writable by user so the session can be stored
As already mentioned this could be happening due to fcgi handler permission issues. If you're using suexec - don't forget to check if apache has this module enabled.
I increased max execution time to 600 seconds job done !
If you're on a shared server like me the host said it was a result of hitting memory limits, so they kill scripts which results in the "Premature end of script headers" seen in this error. They referred me to this:
https://help.dreamhost.com/hc/en-us/articles/216540488-Why-did-procwatch-kill-processes-on-my-Shared-serv
Given an increase in memory, the issues went. I think a backup plugin Updraft on wordpress was perhaps over zealous in its duty/settings.
In my case I was using a custom extension for my PHP files and I had to edit /etc/apache2/conf-available/php7.2-fpm.conf and add the following code:
<FilesMatch ".+\.YOUR_CUSTOM_EXTENSION$">
SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost"
</FilesMatch>
I've tried the majority of answers that I've found on this issue. My issue was with wp-cron.php executing a particular function.
I'm working on Plesk CentOS7, Apache server.
I used this related question and suggested answer to help me find out how to adjust the fcgid.conf memory limit utilizing the command line.
Upon trying to troubleshoot the limits on the fcgid.conf file (/etc/httpd/conf.d/fcgid.conf) and restarting apache gracefully, I found that there was no change.
After seeing that other cron jobs were running properly, I decided to refer back to my function declared in functions.php and found that some of the arguments declared were not being specified properly, so there was a loop occurring that would eventually lead to the timeout.
Upon fixing this and running the cron again, it ran as it should.
Hope this helps someone else in a similar position!
I got the same problem (with Plesk 12 installed).
However, when i switched from execute PHP as FastCGI to Apache Module the website worked.
Checked my suexec log:
$ cd /var/log/apache2/
$ less suexec.log
When you find something like this:
[2015-03-22 10:49:00]: directory is writable by others: (/var/www/cgi-bin/cgi_wrapper)
[2015-03-22 10:49:05]: uid: (10004/gb) gid: (1005/1005) cmd: cgi_wrapper
try this commands
$ chown root:root /var/www/cgi-bin/cgi_wrapper
$ chmod 755 /var/www/cgi-bin/cgi_wrapper
$ shutdown -r now
as root.
I hope it can help you.

OpenSSL issue on Debian server

I've been battling this annoying issue for quite some time now, and it's bugging me a lot that I can't find any fix for it.
When I use "tail -f" to my error_log file to check for errors on my webserver, one specific error keeps popping up all the time, every visitor and page-refresh generates this issue.
I've been googling and searching here on Stack Overflow for a looong time, but nothing is directly related to the problem.
So the error that is thrown looks like this:
[Fri Aug 17 00:16:23 2012] [error] [client xx.xx.xx.xx]
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/openssl.dll' - /usr/lib/php5/20090626/openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0, referer: http://mysite.dk/
What could I do?
I have tried to remove OpenSSL, and re-installed it again with no luck. I've tried to upgrade every PHP-related package and still didn't work.
grep -ir ssl /etc/php*
gives:
/etc/php5/cli/conf.d/zend_extensions_psa.ini:extension=openssl.dll
/etc/php5/apache2/conf.d/zend_extensions_psa.ini:extension=openssl.dll
/etc/php5/apache2/php.ini.saved_by_psa.08.03;20:24:;extension=openssl.dll ; moved to conf.d/zend_extensions_psa.ini by Plesk
/etc/php5/apache2/php.ini:;extension=openssl.dll ; moved to conf.d/zend_extensions_psa.ini by Plesk
/etc/php5/conf.d/zend_extensions_psa.ini:extension=openssl.dll
/etc/php5/cgi/conf.d/zend_extensions_psa.ini:extension=openssl.dll
So you've got four copies of zend_extensions_psa.ini and all of them are trying to load this nonexistent file. Edit them all, delete or comment out the lines mentioning openssl.dll, and all should be well.
The Debian package management system treats your modifications to configuration files with great respect. It doesn't undo them when you upgrade or reinstall a package unless you remove the the package with dpkg --purge or install the new one with --force-confnew.
It could be that you have something like this in your PHP configuration (php.ini maybe):
extension_dir=/usr/lib/php5/20090626/
and then
extension=openssl.dll
And it could cause a problem because there is no file like that in a given path. This could be caused by manually copying extensions and/or different extensions installers.

Categories