Error after activation of 'Add from server' plugin
-
Fatal error: Call-time pass-by-reference has been removed in C:\Program Files\wamp\www\vis.ru\wp-content\plugins\add-from-server\class.add-from-server.php on line 137
https://www.ads-software.com/extend/plugins/add-from-server/
-
I got this error as well.
I’m running WordPress 4.1.2 on my local machine.
I emailed the developer about this issue and linked him (or her) to this post.
Have you found a solution?
(Take care!)
UPDATE:
The issue is caused by a technique that I don’t understand that is now deprecated in PHP 5.4. I alerted the plugin developer and he said he would update the plugin when he was the time.
Here were my resources (in case they’re useful)
https://stackoverflow.com/questions/1055812/how-to-avoid-call-time-pass-by-reference-deprecated-error-in-php
https://stackoverflow.com/questions/8971261/php-5-4-call-time-pass-by-reference-easy-fix-availableI solved the issue, at least for the time being, but changing line 137 of wp-content > plugins > add-from-server > class.add-from-server.php to this:
$this->settings = new add_from_server_settings($this);
// this is what line 137 used to be
// $this->settings = new add_from_server_settings($this);I successfully uploaded 100 images larger than 2 MB each, so so far there is no bad side-effect.
I also wanted to use this function with the NextGEN Gallery plugin but didn’t find how to use it. However, I did find how to upload files larger than 2MB to a NextGEN Gallery. I’ll let you know how I did it in case you want to know.
? Upload the photos via FTP to wp-content > gallery > [name of gallery]
? Do Dashboard > Gallery > Manage Gallery > [open gallery] > Scan Folder for new images, and that creates thumbnails of the images you deposited
? Then add tags or do anything else you want with the images.
I made the changes to the file that you mentioned above, however for me it doesn’t make any difference. It still crashes after 30 x 1MB jpg files or 10 x 2-3MB files.
Any other idea of how to fix it? Its been irritating me for a while now.
Many thanks
nanoo_k
The line of code you reference does not exist on line 137 it does however appear on line 237. I do not see any difference in the two lines of code you show. Did you remove the & from ($this). I did do that and receive a differnece error. ” Cannot modify header information – headers already sent by (output started at /home/strouds/public_html/wp-content/plugins/add-from-server/class.add-from-server.php:1359) in /home/strouds/public_html/wp-includes/pluggable.php on line 876″
Sorry about that. The line I changed looked like this:
$this->settings = new add_from_server_settings($this);
// this is what line 137 used to be
// $this->settings = new add_from_server_settings(&$this);It was the ampersand that I deleted.
I’m not sure why the change worked for me but not for either of you.
@inversion
Have you changed your default upload size limit? It begins at 2MB and you can change the limit by modifying php.ini. Using WAMP on Windows 7, my file is found here: wamp > bin > php > php 5.4.3 > php.iniAnd here is what I changed:
upload_max_filesize from 2M to 64M
memory_size from 64M to 128M
post_max_size from 8M to 64MTo change, for example, the first line, just search the file for “upload_max_filesize” and then change 2M to 64M. I also heard of a method where you create a new php.ini file in your theme folder, but I don’t have instructions atm.
@slabadie
Not sure why you got that error. Maybe code in pluggable.php on line 876 relies on the code you’re changing in class.add-from-server.php? If that’s so, then maybe you need to temporarily disable the code that’s relying on class.add-from-server.php.Just a thought.
Immediately after activating the add_from_server plugin, my WordPress site crashed (the Admin Dashboard only – not the main site itself).
This is probably because I am using PHP 5.4.
I have root access to the Linux shell (running WordPress on AWS), and when I do:
php --version
it says:
PHP 5.4.11-1~precise+1 (cli) (built: Jan 24 2013 15:22:16) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Let’s look at this from a broader perspective: not involving just this plugin, but the larger question of “Why does the PHP community consider it normal to use a plugin to do something which could easily be done using mysql through the command line (or through something like PHPMyAdmin?”
Before anyone says “hey it could be dangerous to just add stuff via the command line or via PHPMyAdmin” let us remember: this is what add_from_server purports to do (only more opaquely: using PHP). So we’re doing it anyways – just opaquely, via a (possibly outdated) plugin, rather than doing it ourselves transparently, on the command line or via PHPMyAdmin.
It would be nice there were some documentation somewhere simply explaining which records need to be inserted into which MySQL tables in order to for WordPress to “see” a newly uploaded media file – and in which order these insertions should be performed (in case there are any foreign relationships causing dependencies between tables). I imagine this was the information which was used to create the add_from_server plugin. Where is this information?
I realize that many WordPress users can’t or don’t want to directly access their MySQL tables. On the other hand, I have installed SQLBuddy on my server (since PHPMyAdmin is too “heavy” in my opinion), so I could insert records into MySQL (imitating what add_from_server is attempting to do) – if there were some easy-to-find documentation telling me which records to insert in which tables and in which order. It would be much easier and more stable to do it this way, instead of relying on a plugin which may or may not work depending on which version of PHP I’m using.
This is part of the “Keep It Simple” philosophy: If you want to add a record to MySQL, then use MySQL – don’t download a plugin to do it through PHP.
+++
As we know, media is added to a WordPress site in two steps:
(1) The file is uploaded to a certain directory on the server.
(2) WordPress is “informed” of this fact via records being inserted in a couple of MySQL tables.At some point, it just gets to be counterproductive adding layer upon layer of complexity to our systems – eg, doing the above two steps via a plugin using PHP – when the definition of PHP itself is constantly shifting like quicksand. (As mentioned by SimonSimCity above, evidently the designers of the PHP language recently decided that the language feature known as “reference sign on function call” is a bad programming practice, and they removed this from the language a while ago – but the add_from_server plugin used this language feature, so it crashes in PHP 5.4.)
After trying dozens of CMSs, and after so many bad experiences installing and using PHP (at one point I had to wipe an entire server, due to conflicts between some of the countless components needed to use PHP with a particular web app such as WordPress), I finally resigned myself to using WordPress simply because the large size of the community (making many plugins available) can cancel out some of the shakiness of working in a poorly designed language such as PHP. (There, I said it, so flame away.)
In this sense, due to the sheer number of plugins, WordPress can be considered a “de facto” web application framework itself – at least for CMS web apps, because it is often easier to reach out and grab a WordPress plugin rather than writing the same functionality from scratch yourself. (So at least I’m a realist: I may not like PHP, but I know that I have to use it, simply because everyone else does.)
By the, way, this story has a happy ending.
I had already learned to be paranoid about installing new WordPress plugins – after a previous installation of a WordPress plugin took down my entire site.
So, although the add_from_server plugin is very tiny (I looked at the code), I still decided to be paranoid and I made a backup before installing it. (On Amazon AWS, I created a snapshot.)
I am so glad I did this. After the installation of add_from_server killed my WordPress Admin Dashboard, I simply restored the AWS snapshot, and my site back up and running again in minutes.
This suggests a philosophy going forward, of being conservative and paranoid regarding plugins:
– Conservative: Only install a plugin when absolutely necessary. (Because PHP and WordPress itself change so often, there is no guarantee that the plugin will work with your version of PHP and WordPress. And as I have seen twice, a plugin can take down the entire site.)
– Paranoid: If you do decide you absolutely must install a plugin, then back up your entire website/server before installing any plugin. It would even be better (if you have an additional server available) to test restoring this backup to the new server, before assuming that you really do have a usable backup.
Unfortunately, given the current state of the art in web programming, we have to practice this sort of “defensive web admin”.
@nanoo_k: I tried adding a new php.ini to the folders (which has worked for other plugins and extending the post size if you drop it into the root of your wordpress install), but nothing seemed to work. It still crashes after about eight 2-3MB pictures ??
@donaldscott: I share your frustration when it comes to these issues, but I think the dev on this project needs to do an update to make it work properly with the latest version of wordpress and the new media library interface OR hand the project over to someone who will pursue it further.
Keeping things short and simple is good, but for most wordpress users, I think a plugin with a simple interface is better for them. Some people get scared when you start talking about editing the DB ??
Lets keep up the pressure so MAYBE just MAYBE the dev might kindly take some time to update this useful plugin or like I said, hand it over.
I made the following change to line 137 of the class.add-from-server.php of the plugin, and it worked.
“Original String”: $this->settings = new add_from_server_settings(&$this);
changed to this: $this->settings = new add_from_server_settings($this);
Only difference being the “&”.
The error I was receiving was:
Fatal error: Call-time pass-by-reference has been removed in /homepages/31/d451794017/htdocs/app/wp-content/plugins/Add-From-Server1/class.add-from-server.php on line 137
I know it’s old but just want to say thanks to krkowallis – ran into the same issue today and your fix worked
hello
I have still this problem, with the same errorFatal error: Call-time pass-by-reference has been removed in /home/civicrm/public_html/wp-content/plugins/add-from-server/class.add-from-server.php on line 137
but what’s VERY strange is that the error persist also if I delete the plugin!!!
What can i do?
- The topic ‘Error after activation of 'Add from server' plugin’ is closed to new replies.