ShaneMcC / phprouter

PHP Scripts for interacting with network devices.
MIT License
9 stars 6 forks source link

ssh error on Ub 12.04.5 php 5 #8

Closed mmashraf closed 4 years ago

mmashraf commented 4 years ago

I just copy base code for ssh to my router but it does not work and prompt me following error

PHP Parse error: syntax error, unexpected '[' in /var/www/test/phprouter/impl/NetworkDevice.php on line 64

mmashraf commented 4 years ago

<?php

include('phprouter/PHPRouter.php'); $router = new CiscoRouter('58.2.x.x', 'ash', 'test123'); $router->connect(); $router->enable('enable'); $config = $router->exec('show run'); $router->disconnect();

    echo $config;

?>

ShaneMcC commented 4 years ago

Hi,

The code uses some features only available in PHP 7.

PHP 5 has been EOL since Dec 31st 2018.

It could probably be made to work by changing instances where I've used the [ ] syntax for arrays to be array() but I'd recommend upgrading to php 7.