PHPUnit working in IDE, but server says class not found

后端 未结 2 1764
伪装坚强ぢ
伪装坚强ぢ 2021-01-27 14:37

I am using the Symfony3 plugin in PhpStorm. My PHP Interpreter is 7.0.18. I have PHPUnit 6.3.0 configured in PhpStorm by having the .phar file in the root directory

2条回答
  •  故里飘歌
    2021-01-27 15:24

    I have PHPUnit 6.3.0 configured ... by having the .phar file in the root directory of my project

    Such a bad idea. PHPUnit should not be installed on your (production?) server.

    If this is a local staging server that you're trying to test on, then you need to install the phar in the path.

    To globally install the PHAR:

    $ wget https://phar.phpunit.de/phpunit-6.2.phar
    $ chmod +x phpunit-6.2.phar
    $ sudo mv phpunit-6.2.phar /usr/local/bin/phpunit
    $ phpunit --version
    

    Also, consider upgrading PHP to the newest version. There are several vulnerabilities in the one you're using. (See: change log for versions between yours and current).

    EDIT:

    Why are you running bin/console server:start on your server? Also not meant to be on a production server.

    My guess here is that it is seeing the phar in your document root and trying to execute it, which is what is causing all the errors.

提交回复
热议问题