Silverstripe CMS gives File size zero error - error-handling

I have designed a page that has upload attachments ... one image and another PDF.
The data is created in the database, however, when trying to upload a file of either type I get a server error "File Size is zero bytes".
A search of this forum yielded entries that indicate it is a permission issue of site assets folder or assets/Uploads folder. I have checked both and the permissions are correct.
The search on other platforms seems to indicate file size issues are from the PHP5.6 php.ini file settings. Both are correct and set to a value well above the 8Mb default.
The Apache2 log looks like:
[Tue Jun 06 15:11:57.167558 2017] [:error] [pid 26971] [client 192.168.1.73:50192] PHP Warning: mkdir(): Permission denied in /var/www/html/ss/framework/filesystem/Filesystem.php on line 53, referer: http://192.168.1.70/ss/index.php/admin/pages/edit/show/23
[Tue Jun 06 15:11:57.170810 2017] [:error] [pid 26971] [client 192.168.1.73:50192] PHP Warning: copy(/var/www/html/ss/assets/Uploads/news-attachments/the-satern-ring.pdf): failed to open stream: Permission denied in /var/www/html/ss/framework/filesystem/Upload.php on line 207, referer: http://192.168.1.70/ss/index.php/admin/pages/edit/show/23
This code also seems to indicate a permission issue. The folders all have the owner as root group as root and drw-rw----, files can be uploaded manually but not through the CMS.
So where do I look now?
Environment:
SS v3.6.0 theme bootstrap
OS Linux Mint 18.1
Apache 2.4 PHP 5.6

This can occur when framework does not have permission to write files to the server. If this is the case, when we upload images through the CMS the file can not be written to assets and the CMS returns a "File size zero error". The website also cannot combine files (such as JavaScript and CSS files) and cannot create new resampled images.
To help investigate this problem we can run the SilverStripe install wizard. The install wizard will notify us of issues preventing SilverStripe from running correctly.
To run the install wizard we visit http://www.example.com/install.php
The install.php is usually deleted after the site is installed, so if it is missing we will need to replace it. We can download the file from github. Here is the install.php file for SilverStripe 3.6: https://github.com/silverstripe/silverstripe-installer/blob/3.6/install.php
Once downloaded we upload this to the root directory of our webserver. Once this is done we can visit the install.php URL.
Here is a screenshot showing an example of the file permission issue warnings that the install wizard outputs:
What we want to do now is fix up all the warnings that the install wizard is reporting.
If this is a shared hosting environment we might not have the ability to fix these issues ourselves. In this case we should be able to send the install.php link to hosting support asking them fix the issues.
Once all the issues are fixed the site should work correctly. Make sure to delete the install.php when we are done.

Related

Can't load 'C:/Apache/Perl/site/lib/auto/Apache2/ModSSL/ModSSL.dll'

I am running an Windows Server 2008 R2 Enterprise with an Apache Server installed and mod_perl & mod_ssl
I just installed Apache2::ModSSL, but i was not able to use cpan for this and had to compile it using nmake. CPAN is not working correctly on this Server and i am not able to change this.
A perl script called via https should later be able to Access the certificate the Clients used to authenticate, thats why i want to use Apache2::ModSSL to Access the SSL variables.
When i try to acess my test script after implementing
use Apache2::ModSSL;
i get an HTTP500 error from the Server.
The Servers error log states
[Fri Jul 01 15:01:58 2016] [error] [client 10.217.139.184] failed to resolve handler `ssl::hello': Can't load 'C:/Apache/Perl/site/lib/auto/Apache2/ModSSL/ModSSL.dll' for module Apache2::ModSSL: load_file:The specified module could not be found at C:/Apache/Perl/lib/XSLoader.pm line 68.\n at C:/Apache/Perl/site/lib/Apache2/ModSSL.pm line 8\nCompilation failed in require at ssl/hello.pm line 7.\nBEGIN failed--compilation aborted at ssl/hello.pm line 7.\nCompilation failed in require at (eval 3) line 3.\n
When i check the file Location, ModSSL.dll is stored at exact this path. I also checked the file Access and granted Full acess to All Users, System, Administrators etc. Apache was restarted multiple times and it did not Change anything.
When i tried to execute it in a cmd, obviously there was no Connection to check but i could execute
use Apache2::ModSSL;
print Apache2::ModSSL->VERSION;
without Problems.
How to solve the issue with loading the module within Apache?
Server readme states
This is a binary distribution for Win32 of Perl 5.8.7 and Apache
2.0.54, together with mod_perl-2.0.1, mod_ssl / OpenSSL (0.9.7g), and php-4.3.11, all built with VC++ 6.0 (SP5).
cl -version states
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
nmake -version states
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Without investigating too deeply, the most likely reason for your problem is that perl, OpenSSL, mod_ssl etc where compiled with a different compiler than the one you used to build Apache::ModSSL.
It seems to me that the module only tries the XS version if it thinks it's running under mod_perl. You can see this in the module's Apache2/ModSSL.pm:
XSLoader::load __PACKAGE__, $VERSION
if( exists $ENV{MOD_PERL} and $ENV{MOD_PERL}=~/mod_perl/ );
It only tries to load the XS component if the MOD_PERL environment variable exists and it contains mod_perl. My guess is if you did:
C:\> set MOD_PERL=mod_perl
C:\> perl -MApache2::ModSSL -e "print $Apache2::ModSSL::VERSION"
you would encounter problems.
In addition, I feel I must emphasize the facts that your OpenSSL version in addition to perl and php seem too old to be used safely.

Vagrant for web server with shared folders: Apache breaks file permissions if it tries to stat a file before it exists

I'm not sure if this is an issue with vagrant, virtualbox or a configuration issue inside the box itsef, however:
Using the following setup: Apache is running in the guest with its server root set to /srv/http, this is a synched folder which points to ./public_html on the host.
While most of the time it works as expected, the following steps causes an issue
1) Navigate to a file that doesn't exist localhost:8080/test2.css -- shows a 404 error as expected but correctly connects to the guest which is serving the error
2) Create test2.css with some content and place it in public_html
3) Reload localhost:8080/test2.css -- Still shows a 404 error even though the file now exists
4) To debug, run vagrant ssh and then ls /srv/http. Which shows:
ls: cannot access test2.css: No such file or directory
So it's seeing the file, sort of but it shows without any permissions:
-????????? ? ? ? ? test2.css
-rw-rw-r-- 1 vagrant 7 Oct 23 11:13 test3.css
If I then re-save the file as test3.css, a file that hasn't yet been accessed it works perfectly. E.g. on the host, save the file I had open as test3.css and then navigate to it, it works as expected!
Any ideas? On why this might be?
In short: If apache has tried to read a file that doesn't exist, creating that file will then cause it to have invalid permissions. If apache has never tried to read the file before, it can be created and work as expected.
Thanks for any help, I'm really confused by this!
This turned out to be a kernel bug on the guest. Upgrading to 4.2.4 using the same Vagrant/Virtualbox/Guest Modules solved the issue.

Unable to Load SSL Module in IBM HTTP Server v8.5

Yesterday I was able to successfully install IBM HTTP Server, and everything was working great until I attempted to begin configuring the SSL settings.
When attempting to load the SSL module by adding the following to my httpd.conf file:
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
...the server will fail to start up, and I see the following in my error_log:
[Tue Feb 17 16:33:29 2015] [info] mod_unique_id: using ip addr <removed>
(20019)DSO load failed: SSL0166E: Failure attempting to load GSK library (libgsk8ssl_64.so), libgsk8ssl_64.so: cannot open sharedobject file: No such file or directory
Configuration Failed
I have confirmed that I have GSKit installed with the gskver command:
libgsk8ssl_64.so
============
#(#)CompanyName: IBM Corporation
#(#)LegalTrademarks: IBM
#(#)FileDescription: IBM Global Security Toolkit
#(#)FileVersion: 8.0.50.34
#(#)InternalName: gskssl
#(#)LegalCopyright: Licensed Materials - Property of IBM GSKit
(C) Copyright IBM Corp.1995, 2014
All Rights Reserved. US Government Users
Restricted Rights - Use, duplication or disclosure
restricted by GSA ADP Schedule Contract with IBM Corp.
#(#)OriginalFilename: libgsk8ssl_64.so
#(#)ProductName: gsk8g (GoldCoast Build) 140910
#(#)ProductVersion: 8.0.50.34
#(#)ProductInfo: 14/08/13.01:22:06.14/09/10.13:23:58
#(#)CMVCInfo: gsk8g_140909/gsk8g_ssl gsk8g_140909/gsk8g_cms gsk8g_140909/gsk8g_support gsk8g_140731/gsk8g_pkg gsk8g_140909/gsk8g_acme gsk8g_140909/gsk8g_doc gsk8g_140909/gsk8g_ikm
No other modules seem to be causing any issues. I'm at a bit of a loss as to what is causing this. Any ideas?
Check out the apachectl and envars scripts. Especially envars. Sometimes these scripts are modified for running third party modules. The path for the GSKit libraries are typically set up in the envars script.
I found the shared library symbolic links were missing from /usr/lib and /usr/lib64. If you (re)create these links, it may clear your problem. I navigated to the library directory (/usr/lib64 in this case) and ran (as root):
for name in $(ls -1 /opt/IBM/WebSphere/HTTPServer85/gsk8/lib64);
do ln -s /opt/IBM/WebSphere/HTTPServer85/gsk8/lib64/$name ./$name;
done
Of course change the source directory to what ever your install standard is. It created all the links necessary in my case.
A.

Moving Smarty website to new server

I'm moving a website to a new domain and server and I'm running into some problems. This website works with Smarty, and I've never used it before. I think I got a very basic problem, but I can't find the answer online.
I've moved all the FTP files to the new server
I've copied the database
I've edited the config file with the new database information
Now only EVERY page (even a blank test.php file with a simple echo) I get "failed to open stream" errors.
Warning: rename(/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php) [function.rename]: failed to open stream: Permission denied in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_write_file.php on line 48
Warning: rename(/tmp/wrtPBIHNP,/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php) [function.rename]: Permission denied in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_write_file.php on line 48
Warning: chmod() [function.chmod]: No such file or directory in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_write_file.php on line 50
Warning: include(/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php) [function.include]: failed to open stream: No such file or directory in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_template.php on line 432
Warning: include() [function.include]: Failed opening '/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_template.php on line 432
It looks like a problem with premissions, but I've made EVERY file on the FTP premission 777 (to test) and this does not solve it.
There are two backslashes /public_html//skins/ which is weird.
The code is exactly the same on the "old" server, besides the config file. Only thing new is the domain name.
What am I doing wrong?
You should set for directory compiled permissions 755 or 777.
You should probably also remove all compiled and cached files (if you use cache) because it may also cause problems

running amixer through cgi

I'm trying to run shell commands (amixer set Master 1+ for example) through web interface.
I have set up apache on the target server (Ubuntu 12.04, desktop) and tested the setup with a simple Hellow world! script. Everything works fine but if I try to do this with amixer I don't get any result. I don't even get any output though if I try to print the output to a file the file is created.
I'm not sure if this is configuration issue or a missing command issue.
How can I achieve this?
Edit:
I attach here part of /var/log/apache2/error.log which I think is relevant
amixer: Mixer attach default error: No such file or directory [Sat May
26 17:54:05 2012] [error] [client 192.168.1.103] File does not exist:
/var/www/favicon.ico
I'm sorry for the late respond, due to unexpected maintenance work, I had to leave home for several days.