How to diagnose file upload failures in SilverStripe running on Apache - php

I am facing a pretty common situation judging from the questions either here on SO or in the SilverStripe forums: file uploads fail.
However, my situation seems to stem from an issue that I haven't met yet on the Web; from reading other questions and many blog articles or forum threads, I have ruled out:
Permission problems
upload_max_filesize and post_max_size in the PHP configuration (both set to 8M)
LimitRequestBody in the Apache Configuration (default value of 0, meaning "unlimited")
I have ruled these out for many reasons but this picture shows with an example of three consecutive uploads that the uploads are sometimes working:
I have also started a thread on the SilverStripe forums for this problem, but I have little hope of having luck solving the problem there.
I have set up breakpoints in the Upload, UploadField and File classes, and stepped through the code for hours without succeeding in identifying the cause of the error.
My finding so far is that any file above 128 kiB causes an internal server error. Any file below this size threshold gets uploaded as expected.
All logs (Apache, PHP, SilverStripe) are totally mute when this error occurs.
A permission issue seems very unlikely because:
PHP runs in Fast-CGI mode as a user (web1) created by ISPConfig
Apache runs as user apache:apache
I have added apache to the group of user so that groups web1 gives me web1 : client1 sshusers and groups apache gives me apache : apache ispapps ispconfig client1
the upload folder (assets) is owned by web1:client1 and has permissions 775
the temporary upload folder (upload_tmp_dir) is owned by web1:client1 and permissions are 775.
I believe what I'm looking is a means of somehow getting information about where and why the uploads fail. Is it possible to set the loglevel of Apache to "debug" or "trace"?
NOTE: an entry in the "Similar Questions" led me to this answer, which hints at SSLRenegBufferSize being by default at exactly 128 kiB. Unfortunately, whether the protocol is HTTPS or HTTP has no influence: the problem shows up.
[EDIT] I had later on set the LogLevel directive to trace but I still had no message about this error in the server logs.

Quick googling took me to the following articles:
Debian Jessie - Apache2 / PHP 5.6, can't upload more than 128kb
https://wordpress.org/support/topic/cant-upload-images-larger-than-128kb-http-error
Those suggest to check FcgidMaxRequestLen setting value.
This doesn't answer how to debug that correctly but helps solve the original issue.

Related

Premature end of script - causing internal error 500 of php files

first I wish you a happy new year!
I got the following problem:
I receive an Internal Error 500 when trying to open one of my websites on my server which uses .php files. All Domains configured on this user don't work. The Domains configured on other users are working fine.
Checking out the error log gave me the error "Premature end of script". Until yesterday everything worked fine and I haven't made changes since than.
I checked out the following possibilities:
APC in php.ini -> doesn't exists in my php ini (https://www.drupal.org/node/213260)
File Permissions (500 Server error: Premature end of script headers:)
RLimitCPU and RLimitMEM
some other things with general configuration, but they can't be the reason because my other sites with php are working fine
I compared the Apache config of the different domains but couldn't find a relevant difference. Unluckily I changed the rights of the files in this directory and now my ftp isn't working anymore (set them to 705). Any Ideas on both problems?
Server is CentOS 6.7 with PHP 5.3.3 and Webmin Interface
FTP Server is ProFTPD
Thanks in advance!
I solved the problem with the premature end of script. The quota of the user was more than full, which was done by a failure in a cronjob. facepalm

IIS Plesk Shared Hosting Wordpress started to give 500.50 error out of nowhere for some files

I have my Wordpress on Shared IIS hosting using Plesk. Today, just by itself, some of my uploaded files started to give this error:
HTTP Error 500.50 - URL Rewrite Module Error. The page cannot be
displayed because an internal server error has occurred.
Most likely causes: IIS received the request; however, an internal
error occurred during the processing of the request. The root cause of
this error depends on which module handles the request and what was
happening in the worker process when this error occurred. IIS was not
able to access the web.config file for the Web site or application.
This can occur if the NTFS permissions are set incorrectly. IIS was
not able to process configuration for the Web site or application. The
authenticated user does not have permission to use this DLL. The
request is mapped to a managed handler but the .NET Extensibility
Feature is not installed.
Things you can try: Ensure that the NTFS permissions for the
web.config file are correct and allow access to the Web server's
machine account. Check the event logs to see if any additional
information was logged. Verify the permissions for the DLL. Install
the .NET Extensibility feature if the request is mapped to a managed
handler. Create a tracing rule to track failed requests for this HTTP
status code. For more information about creating a tracing rule for
failed requests, click here.
The interesting thing is that, when a file is uploaded, it's other dimension versions are created, and I have no problem accessing those. But when I try to access the original file, I'm getting that error. When I try to inspect file permissions on my Plesk control panel, the wp-content and the uploads folder does have the write permission to my user, but when I check the problematic file, Plesk can't access it from the control panel too:
Unable to get the object (C:\Inetpub\vhosts\PATH-TO-MY-IMAGE) security
info: (5) Access is denied. at execute "C:\Program Files
(x86)\Parallels\Plesk\admin\bin\filemng.exe" MY_USER_NAME
--permissions --list-common "--file=C:\Inetpub\vhosts\PATH-TO-MY-IMAGE"
"--accounts=tmpB575.tmp"(RunTime::RunAsUser::run line 260) (Error code
1)
---------------------- Debug Info -------------------------------
I can't even read the permissions on that file. Trying to delete the file using FileZilla results in an error too. This happened to SOME files today, and NOT to others, regardless of upload order, file name or type.
I've checked out many pages regarding this, but they all point to one thing: editing PHP.ini file to change the upload folder. After some search I've created a new PHP.ini like this:
upload_tmp_dir = "C:\Inetpub\vhosts\PATH_TO_A_FOLDER_THAT_I_CAN_WRITE_TO_IN_MY_HTTPDOCS_FOLDER"
Uploaded it to my httpdocs folder, restarted my app pool from Plesk, but no avail. I try uploading new files and I still get the same error. What I haven't understood is that why this started happening today and why is this happening completely randomly (I haven't changed any setting, I haven't entered into any settings pages for weeks). Is this something related to my configuration or should I contact my hosting provider?
It turned out to be a problem with my hosting company at their side. There was nothing I could do.

Changing Maxclient setting in php heroku

I am new to heroku,i am getting the below warning in server logs. I have just uploaded my php scripts into the heroku through git I am not sure where my Maxclient setting is present too..
server reached MaxClients setting, consider raising the MaxClients settings
I saw in many posts to chnage Maxclients in httd.conf. I am not aware of the apache server folder sturucture. Can you please let me know in which path should i keep the httd.conf and also the format of it. You can also direct me to any posts which explains it well
i found the answer.. followed the usage instructions in github.com/heroku/heroku-buildpack-php
and my php code was found to be /app
Later created httd.conf file inside /app/apche/conf

phpBB 500 Internal Server Error and no log outputs

Good morning. I'm having a major issue with my phpBB installation.
I've transfered it to my computer to develop some plugins, so i'm running it on localhost, but, i've created a vHost with the exact same domain he is running online, so, i don't need to change the cookies configuration, and the database connection information is correct already.
Regard all of that, i'm getting a 500 internal server error, which displays no error on the screen nor the logs from apache and php.
I have error reporting on php as E_ALL also. What could be possible causing this, and what the solution might be?
Thanks in advance, Jorge Ferrari.
If you're getting nothing in the Apache / PHP error logs, then it's more likely to be a server configuration issue. I would suspect the problem is in a file called .htaccess in the phpBB folder. It can be used to customize the configuration in various ways, including things like setting up redirects and URL rewriting.
If the htaccess file tries to use an Apache feature which isn't available on the server, then it can generate a 500 error. You can test this by temporarily removing the file, and seeing if the website works at all (albeit possibly with some glitches).
If you've confirmed that it's the source of the problem, then ideally you'll need to enable the missing feature in the server's configuration (or possibly update the Apache installation). Alternatively, you can delete or comment-out the problematic bits of the htaccess file.
Either way, it sounds more like a webserver admin issue than programming. You might have more luck asking on the phpBB forums, or on a different Stack Exchange Q&A site (possibly Server Fault?).
Check whether you have Rewrite module enabled?(most of the this will be the reason)
In httpd.conf and uncomment
LoadModule rewrite_module modules/mod_rewrite.so
If you try to use module which is not loaded you will get 500 internal server error.
Check your modules used in .htaccess file and check httpd.conf whether used modules are loaded

errors in admin area after updating to joomla 2.5

I updated my joomla site to 2.5 from joomla 1.7 I faced below errors:
1- I cannot open global configuration page from the admin area and receive "500 internal server error"
2- When I press the add new article button from the admin area I receive the same error.
3- When I press the add new category button from the admin area I receive the same error.
appreciate if you can help to solve this.
I had the same issue and was about to go crazy (even considered switching to another CMS) ... the problem appears to be related to the fact that Joomla 2.5 is throwing several errors and the PHP engine was trying to write to the php_errors.log file in a directory where it didn't have write permissions, thus the 500 error (misleading I know).
Incidentally, this happened to me on a Windows box running IIS 7.5, not Apache. The solution, intiailly was to edit my PHP.INI file and change the "error_log" setting to point to a folder which had write permissions for all websites. I just created a new folder and gave the 'users' group modify permissions - not the best way to do it but for development purposes, it was ok.
You then have to restart IIS.
It is important that you actually restart IIS, not just restart the application pool, as this didnt seem to force PHP to re-read the config.
Once I got this far, I started noticing errors (which I will continue to post here among other places until I can find a solution). So far, the first error I see is when I go to add a New Menu Item, i get this:
Warning: is_file(): open_basedir restriction in effect. File(\metadata.xml) is not within the allowed path(s): (C:\Inetpub\vhosts\myWebsite.com\httpdocs\) in C:\Inetpub\vhosts\myWebsite.com\httpdocs\libraries\joomla\filesystem\file.php on line 523
It appears that Joomla is trying to verify if the \metadata.xml file exists, however I'm not sure where that file is or what it does. At this point, i suspect it's still ultimately a permissions problem, but I'm still digging...
The most common cause of 500 error that I've seen on Joomla! websites is related to the permissions of the files on the website. eg. yesterday we had to fix a website for a company that had upgraded and in the process somehow set the Group write permission on their /administrator directory.
You can check this quickly through the file manager of your hosting service, if using CPanel you should make sure your directories are set to 755 (User has read/write/execute permissions, Group and World have read permission) and files set to 644 (User has read & write permissions, Group and World have read permission).
These sound like the same issue.
See this rundown of potential upgrade problems by Brian Teeman:
http://brian.teeman.net/joomla-1.7/upgrading-to-joomla-2.5-some-warnings.html
The problem you are having could be related to the database issue he mentions.

Categories