php error: unexpected T_OBJECT_OPERATOR.... trying to install magento using ssh commands to dreamhost
I am trying to install magento (e-commerce platform)
I am following a tutorial that tells me to run this command using ssh: ./pear mage-setup
but I'm getting this error:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/domainname.com/downloader/pearlib/php/System.php on line 400
Line 400 is commented in the code snippit from the system.php file:
/* Magento fix for set tmp dir in config.ini
*/
if (class_exists('M开发者_运维技巧aged_Controller',false)) {
/*line 400 */
$magedConfig = Maged_Controller::model('Config',true)->load();**
if ($magedConfig->get('use_custom_permissions_mode') == '1' &&
$mode = $magedConfig->get('mkdir_mode')) {
$result = System::mkDir(array('-m' . $mode, $tmpdir));
} else {
$result = System::mkDir(array('-p', $tmpdir));
}
if (!$result) {
return false;
}
}
Can anyone help me demystify this error?
I'm wondering what the double-stars are on the fifth line:
# here - v
$magedConfig = Maged_Controller::model('Config',true)->load();**
Edit: You are attempting to use "chaining" ($obj->func()->otherFunc()
) which is only supported in PHP5:
$magedConfig = Maged_Controller::model('Config',true)->load();
Change the line to this:
$magedConfig = Maged_Controller::model('Config',true);
$magedConfig = $magedConfig->load();
Your other option is to upgrade to PHP 5, but at this point in the game, it might break your code.
Verify that you meet the following requirements:
http://www.magentocommerce.com/system-requirements
Magento only runs on php 5.2.x, not 5.3. Also make sure the extensions listed on the requirements page are enabled.
Might be different for you, but I can check the php version using
php -v
Try ./mage mage-setup
instead of ./pear mage-setup
.
The following instruction solved this issue for me:-
Solution:
In the directory that your magento installation is in
nano pear
after the first two lines paste
MAGE_PEAR_PHP_BIN=/usr/local/bin/php5;
export MAGE_PEAR_PHP_BINctrl + o -> to save
ctrl + x -> to exit
The above solution is about editing file named 'pear' present in your Magento root folder through terminal. If you have FTP access then you can simply edit the file 'pear' by adding the following lines at the beginning:-
MAGE_PEAR_PHP_BIN=/usr/local/bin/php5;
export MAGE_PEAR_PHP_BIN
Source: http://www.magentocommerce.com/boards/viewreply/222042/
精彩评论