Hey everyone!

I just finished up installing Drupal at http://209.249.37.234/, and was configuring it to my tastes when I ran into this weird problem. I was at admin > settings > drupal (?q=admin/settings), and it would not let me save my changes. I get this error every time....

Fatal error: Only variables can be passed by reference in /usr/local/psa/home/vhosts/dart.co.uk/httpdocs/modules/system.module on line 212

I'm not sure what could be causing it, since I installed using wget & tar straight from the drupal site - no uploading or anything. To be sure, I did upload a replacement system.module file - no change.

Any ideas? The weird thing is that it will let me "Reset to Defaults" without error.

Comments

carlmcdade’s picture

What's your PHP and MySQL version ? That line is trying to create a temp directory. So the path and the permissions have to be correct.
---------------------------
info for Drupal installation
__________________________
Carl McDade
Information Technology Consult
Team Macromedia
www.hivemindz.com

matthew’s picture

http://209.249.37.234/php.php is the output of phpinfo();

The versions I have are... php 4.3.9, and MySQL 4.0.20. I can't really understand what is going on. Everything else works. Very weird.

Founder, Quabbo Internet Services
PHP Hosting Solutions with the Zend Performance Suite and Urchin
http://www.quabbo.com

matthew’s picture

The status has changed. I had commented out the php directives in .htaccess, perferring to set them another way, and using the ones in .htaccess I am totaly unable to even load the system.module pages.

Every error has to do with line 212, which is...

file_check_directory(file_create_path($directory_temp), FILE_CREATE_DIRECTORY, 'file_directory_temp');

..and here's the area it's in...

// file system:
$directory_path = variable_get('file_directory_path', 'files');
file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');

$directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP); file_check_directory(file_create_path($directory_temp), FILE_CREATE_DIRECTORY, 'file_directory_temp');

$group = form_textfield(t('File system path'), 'file_directory_path', $directory_path, 70, 255, t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is se$
$group .= form_textfield(t('Temporary directory'), 'file_directory_temp',
$directory_temp, 70, 255, t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.'));
$group .= form_radios(t('Download method'), 'file_downloads', variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('$
$output .= form_group(t('File system settings'), $group);

Founder, Quabbo Internet Services
PHP Hosting Solutions with the Zend Performance Suite and Urchin
http://www.quabbo.com

matthew’s picture

I also get the same sort of error at ?q=admin/themes/settings/pushbutton. Arg! I've tried everything I can think of. Any ideas anyone?

"Fatal error: Only variables can be passed by reference in /usr/local/psa/home/vhosts/dart.co.uk/httpdocs/modules/system.module on line 638"

Everything on my end checks out according to http://drupal.org/node/270, the system requirements.

--Matthew Runo
Founder, Quabbo Internet Services
PHP Hosting Solutions with the Zend Performance Suite and Urchin
http://www.quabbo.com

matthew’s picture

The following pages work:
?q=admin/settings/forum
?q=admin/settings/drupal
?q=admin/settings/search
?q=admin/settings/story

The ones that do not work are..
?q=admin/settings
?q=admin/themes/settings/pushbutton

Very, very werid. Is there something wrong with my PHP configuration? Can I see someone's phpinfo() output? Maybe there is something I can find that's wrong.

--Matthew Runo
Founder, Quabbo Internet Services
PHP Hosting Solutions with the Zend Performance Suite and Urchin
http://www.quabbo.com

matthew’s picture

I was able to get everything to work by changing...

$directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP);

to...

$directory_temp = "/tmp";

Should I submit this somewhere? There is obviously something wrong in the variable_get() function, where it passes variables around.

Matthew Runo
Founder, Quabbo Internet Services
PHP Hosting Solutions with the Zend Performance Suite and Urchin
http://www.quabbo.com

dcook’s picture

Recent versions of PHP started being more picky about this issue.

The solution seems to be to use a temporary variable.
For example, I ran into this issue on the following code:

      $theme = array_pop(explode('.', arg(3), 2));

and solved it by replacing the above with:

      $arrayPopExplode = explode('.', arg(3), 2);
      $theme = array_pop($arrayPopExplode);

Hope this helps!

Mayday’s picture

I have tried all of the solutions here and I have not had any luck. I am getting the error all the time. MySQL 4.0.24 and apache 2.0.54 and php 5.1.0b3.

Fatal error: Only variables can be passed by reference in /home/www/default/themes/civicspace/template.php on line 62

Just wanted to post my 2 cents.

sorin_postelnicu’s picture

I have found the same error in another place:
Fatal error: Only variables can be passed by reference in ....\drupal\modules\image\image.module on line 730

The bug is documented at http://bugs.php.net/bug.php?id=33643

The workaround is to introduce a local variable, like this:

Instead of:

$vocabulary = taxonomy_save_vocabulary(array('name' => t('Image Galleries'), 'multiple' => '0', 'required' => '0'.......));

Change to:

$t = array('name' => t('Image Galleries'), 'multiple' => '0', 'required' => '0'.......);

$vocabulary = taxonomy_save_vocabulary($t);

--------------------------------------------------
http://shorinel.blogspot.com