Unable to move uploaded file - Drupal - php

So a client of mine recently was asking me about an issue where they cannot upload any files using Drupal.
The error they get is (and I have now reproduced it - I changed site name to preserve privacy):
warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpwmxeOQ' to 'sites/domain.org/files/Leading_Indicators_5.pdf' in /home/isp/domain-domains/domain.org/includes/file.inc on line 629.
File upload error. Could not move uploaded file.
What can cause this? Permissions issue? Safe mode for PHP? Something else? I've not really found much in the way of searching that leads me to anything concrete. Is it just a problem with a module? Is there any way of fixing it with code?

Related

Ninja Forms / File Upload issue after site migration

I've got a Wordpress site with a Ninja form that's using a file upload add-on. The form was working just fine on my Godaddy staging server. I migrated the site to another Godaddy account and the form stopped working. Being that the hosting accounts, and all other configuration, were virtually identical, I was stumped to understand what the problem could be.
Then I checked the PHP error logs and saw the following:
PHP Warning: mkdir(): No such file or directory in /new/server/wp-content/plugins/ninja-forms-uploads/.../pre-process.php on line 203
PHP Warning: move_uploaded_file(/OLD/server/wp-content/uploads/ninja-forms/tmp/xEgbu/ninja_forms_field_3332): failed to open stream: No such file or directory in /new/server/wp-content/plugins/ninja-forms-uploads/.../pre-process.php on line 209
PHP Warning: move_uploaded_file(): Unable to move '/tmp/phpqrLDo5' to '/OLD/server/wp-content/uploads/ninja-forms/tmp/xEgbu/ninja_forms_field_3332' in /new/server/wp-content/plugins/ninja-forms-uploads/.../pre-process.php on line 209
PHP Warning: mkdir(): Permission denied in /new/server/wp-content/plugins/ninja-forms-uploads/.../processing/process.php on line 154
(FYI: the ellipsis is just a shorthand for unimportant parts of a file path.)
The thing to notice is the new/server/ and OLD/server/ conflict on the second and third PHP Warnings. For some reason, a Ninja Form script is attempting to move a file from a location on the old server to a location on the new server.
Is it possible that Ninja Forms, upon the initial installation, saved the full path of the server as a reference point in the database? If so, can that be found and adjusted without reinstalling Ninja Forms?
Thanks!
Mark
I suffered this too.
As at the end of https://ninjaforms.com/docs/file-uploads/
If you migrate from another server and the File Uploads path is
pointing to the older server location, you can deactivate then
reactivate your File Uploads and Ninja Forms plugins to reset the file
path.
Had the same issue. And while the suggested steps (of deactivating and reactivation File Uploads and Ninja Forms plugins by fiorebat) might have had some role to play but it didn't resolve the issue for me.
The problem was a really really silly thing .. UTF/Charset encoding issue. To solve that, actually type in % and/or any special characters on the Upload settings section of the File Uploads plugin.
I suspect this happens when both WP have different charsets.
Background: We were using a custom path/destination for File Uploads with %year%/%Mmonth% in the path. When we hardcoded the path to say 2019/7 it worked fine. So next, we manually typed in % (or copy from the samples show on the same page) and it custom/dynamic paths worked as well.

PHP Form on WordPress (4.6.1) site

forgive me if is a basic question...
I am working on setting up a form on our new hosted Wordpress site - currently hosted inhouse on IIS/PHP/Wordpress server (I am not JR - but this stuff escapes me and would really like to figure it out!! I hate not knowing)
The OP that made the form / got it working is no longer around and I am sure there is a better way but this is what I have - a request form.
When I load the required files in the same path - copy the code from the WP page and paste it in the new Wordpress page - it loads without formating, the pick box doesnt look right and when I submit the form - I get these below PHP file errors. I can open the path in my browser and it exists - I see the class.GA_Parse.php file)
I checked execustion rights on the scripts - its set to execute - apart from that I dont know why it cant fine the files and that include_path I dont see via my hosting companys dir structure via FTP.
Any help would put me forever in your debt, I hope to be able to return the help, this site looks amazing!
Cheers,
Warning: require(/gaparser/class.GA_Parse.php): failed to open stream: No such file or directory in /home/comany/public_html/stage/forms/getfreetrial_v3.php on line 4
Warning: require(/gaparser/class.GA_Parse.php): failed to open stream: No such file or directory in /home/company/public_html/stage/forms/getfreetrial_v3.php on line 4
Fatal error: require(): Failed opening required '/gaparser/class.GA_Parse.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/company/public_html/stage/forms/getfreetrial_v3.php on line 4
PHP will load pages based on the disk location, not the URL. This means it's starting in the server's root / directory, not in /home/company/public_html/stage/forms. When including a file, either you have to use a relative link:
require('./gaparser/class.GA_Parse.php'); // starts in the same directory as the file
Or use PHP's server variable to get the document root:
require($_SERVER['DOCUMENT_ROOT'].'/gaparser/class.GA_Parse.php');
The paths may need to be tweaked depending on where the file actually is.

In need of some PHP/server help on my mac (Snow leopard)

I'm learning php and mySQL for the first time (using Welling/Thomson) and I'm using my mac as the server. In doing so I'm turning on web sharing and accessing it through something like http://192.168.0.103/~myname/ or localhost/~myname/. I'm able to run basic PHP scripts. I set up everything using this guide. I have each example divided into the chapters: to get to the chapter 1 projects I go through localhost/~myname/book/Chapter02/example.html in my browser. These files are actually stored in /Users/myname/Sites/book/Chapter02/example.html
I'm attempting to do file openings and get the following error:
Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt): failed to open stream: No such file or directory in /Users/myname/Sites/book/Chapter02/processorder.php on line 72
I first thought that it was because the directory and the fopen were different, so instead of storing my files in localhost/~myname/, I tried localhost/public_html/ Storing them there is actually /Library/WebServer/Documents/public_html/ on my computer. I still get the error:
Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt): failed to open stream: No such file or directory in /Library/WebServer/Documents/public_html/Chapter02/processorder.php on line 72
Then I looked it up online and saw that it had to do with permissions. I created a directory in /Library/WebServer/Documents/public_html/Chapter02/ called "orders" with read & write permissions from everyone through the terminal (done with chmod), but still I get the same error. I'm not sure where the problem is. If it is my server set-up, where are the files? Any help would be greatly appreciated.
Here is the php script if you think it will help http://pastebin.com/14gpim8e
I'm trying to be as clear as I can, but I'm sure this will need some clarification so feel free to ask if you need any more information.
Found the answer.
The problem came in 2 ways:
finding where the file was supposed to be, and
permissions.
In this case, it needed read/write permissions from everybody, and it needed to be in the /WebServer/ directory and no lower (as I had been doing in every single directory but the WebServer one. Seems kind of dumb now that I couldn't get it). Thank you all for your help.

Weird PHP error on server

All of a sudden, my SMF powered forum has stopped working.
In fact, PHP files no longer seem to want to open on my website. I tried uploading a blank PHP file with just a few characters of text, and it refuses to open giving the error below.
I also tried a PHPinfo file, which didnt work, giving the same error. Other sites on the same server are working.
Fatal error: Unknown: Failed opening required '/home/users/a/n/mysite/www/index1.php' (include_path='.') in Unknown on line 0
Any ideas about whats gone wrong?
Just an idea. As it happens to all php files that could to what i know only mean 2 things.
Either there is somekind of error on the php extension.
OR what it most likely is, is that SMF uses a .htaccess to make user friendly links. Which means all requests to the server no matter what (Unless specified in the .htaccess) will be sent to index.php and then be handled.
So if there is a error in the index.php or the library of some sort it would explain why no matter what php file you're looking at it gives the error.
-
One thing you could do is to take a backup of all your images in the system. Then try to install a fresh version on your local machine. Once done copy/past the images back and copy all the current php files for SMF and replace the current ones on your host with them.
-
Haven't used SMF much so I'm not sure this is the solution at all. But to me it sounds like a solution.
It seems you have broken your root document.
do chmod 755 index1.php
and it should solve the problem.
You should check the php.ini or php5.ini file. I don't believe the single ticks around '.' for the include_path are valid. Double quotes will work however.
It seems you have been hacked:
http://wordpress.org/support/topic/fatal-error-unknown-failed-opening-required-google_verifyphp
Ahh sorry reread the question. I guess this is what you may try.
Check your file permissions. by default if your web server can not read files thats what you are going to get. I could be wrong but worth having a look
so just chmod your root folder to say 755 atleast

Flex Builder 4, ZendAMF and Data Services - Error?

I'm trying to set up my Flex Builder 4 dev environment, up to and including PHP and the ZendFramework on a WAMP stack on my hard drive.
Everything goes swimmingly until I try to set up a data service. I point it to the php class file, it populates the various fields in the form so I know it understood it, and I press next. After a little bit of tweaking I have the ZendFramework installed and everything seems to be pointing the right way, so I'm not sure why I'm getting this error:
"Make sure that Zend Framework is installed correctly and the parameter "amf.production" is not set to true in the amf_config.ini file located in the project output folder.
Warning: include_once(C:\wamp\www\TestDrive-debug\EmployeeService.php) [function.include-once]: failed to open stream: Permission denied in C:\wamp\ZendFramework\library\Zend\Loader.php on line 146"
What could be causing a permissions error like that? It's not on the system level because I went into properties and fully opened that file up so even a basic user has full permissions - still no dice.
I'm not reeeally a PHP guy so this is a bit beyond my skillset. Has anyone encountered this problem before? I'm just following the tutorial I have here and it SHOULD work. I'm just not clear on what would be causing a permissions issue like this.
Thanks!
I resolved this problem by changing the encoding of the php file. There must be some invisible characters in the file that were screwing up the parsing. Try saving the php service file with different encoding and see if it works for you. The one that worked for me was created by eclipse. I copy pasted the code in it, saved, and boom it worked!
just had same issue and resolved same as OP, just resave file with notepad, funny deal, but it happens
inside the folder of amf_Config.ini , create a new file amf_config2.ini , copy the contents of amf_config.ini as it is into amf_config2.ini , now inside amf_config2 double quote the value of parameter webroot (webroot="xxxxx") save ur amf_config2 , open gateway.php which would be also inside the same dir , change $configfile = "$dir/amf_config.ini" to
$configfile = "$dir/amf_config2.ini" , save it and try

Categories