Enable PHPUnit with Laravel / Homestead on PhpStorm 2016.1 to - laravel

I am working on vagrant / homestead, and have a box configured.
I could enable Xdebug in PhpStorm!
Now, I want to enable PHPUnit, but I can't do it...
I followed several tutorials:
https://blog.mayflower.de/5274-Run-your-tests-with-PHPStorm-on-your-vagrant-box.html
https://confluence.jetbrains.com/display/PhpStorm/Running+PHPUnit+tests+over+SSH+on+a+remote+server+with+PhpStorm
Here are my settings:
Here is the message I receive when running PhpUnit with Code Coverage
vagrant:///Users/julien/Homestead/usr/bin/php -dxdebug.coverage_enable=1 /home/vagrant/.phpstorm_helpers/phpunit.php --coverage-clover /home/vagrant/.phpstorm_helpers/coverage/Laravel_PhpUnit.coverage -- configuration /home/vagrant/Code/vendor/autoload.php /Users/julien/Documents/Proyectos/laravel/tests/functional
Testing started at 11:12 AM ...
bash: line 0: cd: /Users/julien/Documents/Proyectos/laravel/tests/functional: No such file or directory
PHP Fatal error: Uncaught UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php:181
Stack trace:
Fatal error: Uncaught UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181#0 /home/vagrant/.phpstorm_helpers/phpunit.php(181): Phar- >__construct('/home/vagrant/C...')
#1 /home/vagrant/.phpstorm_helpers/phpunit.php(250): IDE_PHPUnit_Loader::init()
#2 {main}
UnexpectedValueException: Cannot create phar '/home/vagrant/Code/vendor/bin', file extension (or combination) not recognised or the directory does not exist in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181
thrown in /home/vagrant/.phpstorm_helpers/phpunit.php on line 181
Call Stack:
0.0006 442920 1. {main}() /home/vagrant/.phpstorm_helpers/phpunit.php:0
0.0006 442920 2. IDE_PHPUnit_Loader::init() /home/vagrant/.phpstorm_helpers/phpunit.php:250
0.0006 451168 3. Phar->__construct() /home/vagrant/.phpstorm_helpers/phpunit.php:181
Process finished with exit code 255

Setting up vagrant with PhpStorm and PHPUnit can be a little bit daunting as it is really not that straight forward... From your console output I'd say that your interpreter setting is not correct since it executes PHP on your local machine.
The way that always worked for me was setting up vagrant as SFTP Deployment Configuration and use that configuration as PHP interpreter. As you are already using Homesteasd, these tutorials might shed some more light onto the setup:
Setting up PhpStorm with Vagrant on a Laravel Homestead box
Setting up Laravel with PHPUnit on Vagrant in PhpStorm
Here are the essential parts:

Related

Imagick extension installation issue xampp

I am trying to install Imagick extension on windows 10 with PHP version 8.0.3 but getting below error
PHP Warning: PHP Startup: Unable to load dynamic library
'php_imagick.dll' (tried: D:\xampp\php\ext\php_imagick.dll (The
specified module could not be found),
D:\xampp\php\ext\php_php_imagick.dll.dll (The specified module could
not be found)) in Unknown on line 0
Windows : 10 X64
PHP version : 8.0.3
Steps to reproduce:
I have added imagick.dll file in xampp\php\ext directory
Added CORE_RL_.dll and IM_MOD_RL_.dll in xampp\php folder.
Added extension=php_imagick.dll in xampp\php\php.ini file
Restarted xammp
Getting below error on webpage
enter image description here
In the PHP error log below error is logged.
PHP Warning: PHP Startup: Unable to load dynamic library 'php_imagick.dll'
First download this: https://windows.php.net/downloads/pecl/releases/imagick/3.7.0/php_imagick-3.7.0-8.0-ts-vs16-x64.zip
Extract from php_imagick-….zip the php_imagick.dll file, and save it to the ext directory of your PHP installation
Extract from php_imagick-….zip all the other DLL files and save them to the PHP root directory (where you have php.exe)
Add this line to your php.ini file:
extension=php_imagick.dll
Restart the Apache/NGINX Windows service (if applicable)

Xdebug Failed loading C:\php\ext\php_xdebug.dll

Issue:
I am getting this error in my Apache log on start up:
Failed loading C:\php\ext\php_xdebug-2.9.2-7.4-vc15-x86_64.dll
Xdebug Wizard:
I used the xdebug wizard, which resulted in these instructions:
Download php_xdebug-2.9.2-7.4-vc15-x86_64.dll
Move the downloaded file to C:\php\ext
Edit C:\php\php.ini C:\WINDOWS\php.ini and add the line
zend_extension = C:\php\ext\php_xdebug-2.9.2-7.4-vc15-x86_64.dll
Restart the webserver
Things I have tried:
Using these variations in php.ini:
zend_extension="C:\php\ext\php_xdebug-2.9.2-7.4-vc15-x86_64.dll"
zend_extension=php_xdebug-2.9.2-7.4-vc15-x86_64.dll
I ensured I was editing correct php.ini file
I checked permissions on dll.
I am using:
Apache/2.4.41 (Win64) VC 15
php-7.4.3-Win32-vc15-x64
php_xdebug-2.9.2-7.4-vc15-x86_64.dll
You're using a release candidate of PHP 7.4.1 (php-7.4.1RC1-Win32-vc15-x64) - you might want to use the latest PHP 7.4.3.
You sometimes get a better error message if you try using PHP's command line.

Laravel 5 and iPage Hosting

I have a shared hosting at iPage. I did the steps listed here : Deploy Laravel 5 using only FTP in a shared hosting (Moving files, editing htaccess) and yet still facing the same 500 error :
20161126T060216: bluepenlabs.com/projects/peugeot/public/index.php PHP
Warning:
require(/hermes/bosnaweb28a/b1452/ipg.bluepenlabscom/projects/peugeot/public/bootstrap/autoload.php):
failed to open stream: No such file or directory in
/hermes/bosnaweb28a/b1452/ipg.bluepenlabscom/projects/peugeot/public/index.php
on line 22 PHP Fatal error: require(): Failed opening required
'/hermes/bosnaweb28a/b1452/ipg.bluepenlabscom/projects/peugeot/public/bootstrap/autoload.php'
(include_path='.:/usr/local/lib/php-5.5.22-amd64/lib/php') in
/hermes/bosnaweb28a/b1452/ipg.bluepenlabscom/ 20161126T061559:
bluepenlabs.com/projects/peugeot/public/index.php
PHP Parse error:
syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE)
in
/hermes/bosnaweb28a/b1452/ipg.bluepenlabscom/projects/peugeot/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
on line 475
20161126T061939: bluepenlabs.com/projects/peugeot/public/index.php PHP
Parse error: syntax error, unexpected '.', expecting '&' or variable
(T_VARIABLE) in
/hermes/bosnaweb28a/b1452/ipg.bluepenlabscom/projects/peugeot/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
on line 475
Note that i'm trying to install the laravel project in a subdirectory /projects/peugeot/
Thank you
I once hosted a laravel project on iPage(shared hosting). I faced 500 errors. Not showing much description.
This may be because of the Laravel 5.3 min server requirements.
Ipage hosting site normally give a version below the min requirement. You need to change the setting on your Control Panel. Try upgrading your PHP version.
Hope this helps.

Debugging a Laravel 5 artisan migrate unexpected T_VARIABLE FatalErrorException

When running artisan migrate on a Laravel 5 project, it is failing with the following FatalErrorException:
$ artisan migrate -vvv --force
[Symfony\Component\Debug\Exception\FatalErrorException] syntax
error, unexpected '$table' (T_VARIABLE)
How do I get the file and line that is causing the error?
If in anyway relevant, I'm on a Windows 7 x64 machine with WAMP - PHP 5.6 and Laravel Framework version 5.1.10 (LTS).
There might be a semicolon or bracket missing a line
Check all in your migration files.
Laravel is configured to create daily log files for your application
which are stored in the storage/logs directory.
http://laravel.com/docs/5.1/errors#logging
This class Symfony\Component\Debug\Exception\FatalErrorException has some differences compared with the other Exception classes and it is not properly presented by the "error renderers" or "error notifiers".
A New sentry "error notifier" ("getsentry/sentry-php" version >= "2.0") will give you a proper stack trace.
Here is issue where is reported : https://github.com/getsentry/sentry-php/issues/761
Here is the PR for fix : https://github.com/getsentry/sentry-php/pull/763

Can't install "Composer Dependency Manager for PHP"

root#rushan-PC:~# curl -sS https://getcomposer.org/installer | php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/gd.so' - /usr/lib/php5/20090626/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mcrypt.so' - /usr/lib/php5/20090626/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mysql.so' - /usr/lib/php5/20090626/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mysqli.so' - /usr/lib/php5/20090626/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: Module 'PDO' already loaded in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/pdo_mysql.so' - /usr/lib/php5/20090626/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The suhosin.executor.include.whitelist setting is incorrect.
Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):
suhosin.executor.include.whitelist = phar
The php.ini used by your command-line PHP is: /etc/php5/cli/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.
Terminal gives me this error. Before that, I installed php packages, there was some error
"Unable to correct problems, you have delayed (held) broken packages." But I can install it with aptitude, instead of apt-get. Perhaps, this dynamic libraries errors because of Held packages? Or something...Please, I need some help there:(. Sorry, I'm just a beginner in Linux and programming. And sorry for my English, cuz I'm from Uzbekistan :(
According to information in your error, you should edit your php.ini file (/etc/php5/cli/php.ini) and add the following line at the end
suhosin.executor.include.whitelist = phar
You should edit your php.ini file (/etc/php5/cli/php.ini) and add the following line before the END: keywords.
suhosin.executor.include.whitelist = phar

Resources