4

Deployer version 4.1.0

When running dep deploy test the following error is reported:

PHP Fatal error: Call to undefined function server()

server ftn is defined as follows in config file:

// Configure servers
server('test', 'test.server.com')
    ->user('user')
    ->identityFile('~/.ssh/id.pub', '~/.ssh/user', 'password')
    ->stage("test")
    ->env('deploy_path', '/var/www/project.com');  

This is pretty much the standard as per the Deployer site. Has anyone else experienced this issue? If so how did you resolve it?

mcv
  • 1,380
  • 3
  • 16
  • 41
  • 1
    Did you make sure deployer is setup correctly on your machine ? [Does their intro work?](https://deployer.org/docs/getting-started) – Ken Jan 27 '17 at 15:04
  • 1
    The error clearly states `server()` isn't defined. If you're using a definition in another file, make sure that file is properly included – Machavity Jan 27 '17 at 15:06
  • I was using a previously deploy config file. I'm going to rename it and try the intro. – mcv Jan 27 '17 at 15:13
  • Please do not add the solution to the question. Instead, add the solution as an answer, then self-accept. – bishop Jan 27 '17 at 16:51
  • @bishop done. I will remove this comment later – mcv Jan 27 '17 at 18:34

2 Answers2

6

SOLUTION

Fixed issue by running the following cmd (Suggested in comments above by Ken)

dep init

Compared the auto-generated deploy.php file to the original. Noted that the following was omitted:

namespace Deployer;

Also noted that ->env has been replaced with ->set

mcv
  • 1,380
  • 3
  • 16
  • 41
1

I had the same problem using deployer on a Laravel 5.4 project:

I had installed deployer using composer, when removed it and worked with deployer.pharfile , everything worked fine.

ako
  • 2,000
  • 2
  • 28
  • 34