PHP scripts are unable to upload file and use it ( WHMCS , JOOMLA ,WORDpress ,... )

rnc

Verified User
Joined
Jun 8, 2013
Messages
72
Hello
Ive mailed this to DIRECTADMIN support and if i get solution will post that this topic as well !
I have a very weird problem on one of my direct-admin server
Ive changed configuration in various combination as I described bellow but still have problem
I cant upload any type of file with php script and I don’t get any type of error on apache log located in
/var/log/httpd/error_log
/var/log/httpd/domains/domain name.error.log
Also ive checked these logs at the moment of problem
/var/log/messages
/var/log//modsec_logs
/var/log/CWAF/ logs
And php fpm it self logs when I was on php –fpm


And here is my current configuration and previous one!

Php 1 : 5.5 fastcgi with apache worker , OPCACHE ,MEMCACHE ,mod-security,upload scan by suhosin and mod sec , suhosin with second php 5.4 as SUPHP!

My previous was
5.5 php-fpm with apache worker , OPCACHE ,MEMCACHE ,mod-security, Upload scan by suhosin and mod sec , suhosin with second php 5.4 as PHP-FPM!

Ive tried to disable mod_sec , upload scan with mod sec _ upload scan with suhosin , and there is no difference !

There are lots of script have problem with this upload issue
Including
Joomal Component installer
Joomshopping unable to upload images
Whmcs unable to attach any type of files to tickets ( from admin or client side )
Php live support unable to upload avatar !

Ive tried to switch to different mod on each domain ( shphp ,fastci , pp-fpm )
And still no luck

This was a working server until that I find this problem 2 month ago and still can’t figure it out !

Thanks
 
Hi
i found that PHP upload Scan wirh SUHOSIN Caused this issue !
but thanks to directadmin support ive found this that after following changes
i will paste directadmin support info for fture uses and testes
================================================
the issue can probably be simplified into a write issue (if that's the problem)
Try creating a test.php file with this sample script:
http://php.net/manual/en/function.file-put-contents.php

<?php
$file = 'people.txt';
// Append a new person to the file
$current = "John Smith\n";
// Write the contents back to the file
file_put_contents($file, $current);
?>

and see if a file called "people.txt" shows up beside your test.php, when you call it through apache.
if that works, then it might be something with the file upload calls.. I'm not sure yet.

after i did that everything worked fine and test,php created a file and put some data into it ( i did not switched to mod php at this point! ) but issue was there and not solved
here is the second response
mod_php + mod_ruid2 would behave in the same way as php-fpm: php runs as the User.
However, it has a more direct link to Apache, so you might get errors more clearly in the Apache logs.

That would be my only though at the moment, if you're not getting any errors anywhere.
You could try editing the upload code to check if the upload function has a @ in front of it, which tells php not to output any errors.
However, if it's a major script, it likely has some sort of checking and we're just not seeing the error for some reason.

Try mod_php + mod_ruid2.
It's the default with CustomBuild 2.0 and is a great choice for shared hosting.
When you also add in opcache, it's probably the fastest too (but don't add opcache until the issue is resolved)

For debugging, if you wanted, the simplest form is mod_php + mod_ruid2, without cwaf or mod_security.


so i turned of mod secuity , all upload scan , suhosin , opcahce and also switched back worker to auto !

and boom ! problem solved !
and agian when i enabled all options that was there ! so i first tried to disable suhosin upload scan ! and yes this was the source of this issue !

i will test more php modes and options on server
but my problem is solved for now! thanks to directadmin great and responsible support !
 
Back
Top