I have two servers.
On the first (local) code works properly,
on the second one (stage) I get syntax error - ofcourse checked a script file (scp & diff).
Braces are enclosed correctly.
Command used to check
php -l template.phtml
stage error
PHP Parse error: syntax error, unexpected '}' in template.phtml on line 135
Errors parsing template.phtml
135 line of file
<?php $i++; } ?>
local output for lint (tried also with second local server)
No syntax errors detected in template.phtml
stage version
PHP 5.5.3-1ubuntu2.5 (cli) (built: Jun 25 2014 17:14:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
local version
PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
antoher local server version
PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep 4 2014 07:08:49)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
In the stage is installed php-fpm (I'm not deal with it).
Any ideas?
Should I deal with php.ini or just reinstall php?
It looks like you're mixing PHP and HTML. Try the colon syntax for that.
Although the best practice would be to separate the PHP code from the HTML code. Something like Smarty can help with that.
Related
A PHPUnit example from the online documentation is not working for me! Please see below for more details.
Your help is appreciated. Thank you in advance!
I'm trying to run the example test below from online documentation but, it is not working for me!
Example 2.7 Using a data provider that returns an Iterator object
The result I'm getting is shown below:
..#VivoBook MINGW64 ~/PHPunit/test-project
$ ./vendor/bin/phpunit --testdox dataProviders
PHPUnit 8.5.32 by Sebastian Bergmann and contributors.
Warning Test Case (PHPUnit\Framework\WarningTestCase)
⚠ Warning
│
│ The data provider specified for DataTest::testAdd is invalid.
│ Error: Class 'CsvFileIterator' not found
│ ..\PHPunit\test-project\dataProviders\DataProviderTest.php:16
│
Time: 77 ms, Memory: 4.00 MB
WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.
PHP info:
..#VivoBook MINGW64 ~/PHPunit/test-project
$ php -v
PHP 7.2.28 (cli) (built: Feb 18 2020 12:54:18) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
The issue appeared because the class in use was not loaded. Loading the class 'CsvFileIterator' using require/require_once solved the issue.
[3884:3870][2022-02-19T01:38:46]e000: Error 0x80070001: Process returned error: 0x1
[3884:3870][2022-02-19T01:38:46]e000: Error 0x80070001: Failed to execute EXE package.
[346C:3470][2022-02-19T01:38:46]e000: Error 0x80070001: Failed to configure per-machine EXE package.
How to solve this error?
One of the fast solutions is installing Visual Studio and reinstalling SSDT again
Solution at https://en.dirceuresende.com/blog/como-corrigir-erro-na-instalacao-do-sql-server-data-tools-ssdt-2017-setup-failed-incorrect-function-0x80070001/, using option "REPAIR".
Microsoft Windows [Version 10.0.22000.795]
(c) Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>cd Downloads
The system cannot find the path specified.
C:\WINDOWS\system32>cd C:\Users\jmont\Downloads
C:\Users\jmont\Downloads>dir
Volume in drive C is OS
Volume Serial Number is E6C1-BFB7
Directory of C:\Users\jmont\Downloads
08/08/2022 02:53 PM <DIR> .
08/08/2022 03:13 PM <DIR> ..
08/08/2022 02:30 PM 552,785,944 Microsoft.DataTools.IntegrationServices.exe
08/08/2022 02:53 PM 957,052,968 SSDT-Setup-ENU.exe
2 File(s) 1,509,838,912 bytes
3 Dir(s) 871,865,147,392 bytes free
C:\Users\jmont\Downloads>vs_sql.exe --layout C:\SSTD2017 --lang en-us
'vs_sql.exe' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\jmont\Downloads>SSDT-Setup-ENU.exe --layout C:\SSTD2017 --lang en-us
For Visual Studio 2017, I had to go to https://learn.microsoft.com/en-us/sql/ssdt/previous-releases-of-sql-server-data-tools-ssdt-and-ssdt-bi?view=sql-server-ver16 and download it from the link below:
SSDT for VS 2017 (standalone installer)
Download SSDT for Visual Studio 2017 (15.9.10)
That was how I downloaded SSDT-Setup-ENU.exe.
I wanna to test my code and coverage. I already install Xdebug extension and when I verify with php -v command, all i'ts good like that :
PHP 7.4.12 (cli) (built: Oct 27 2020 17:18:47) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.0RC1, Copyright (c) 2002-2020, by Derick Rethans
with Zend OPcache v7.4.12, Copyright (c), by Zend Technologies
However if I run phpunit i have a fatal error :
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Fatal error: Uncaught SebastianBergmann\CodeCoverage\RuntimeException: xdebug.coverage_enable=On has to be set in php.ini in C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\vendor\phpunit\php-code-coverage\src\Driver\Xdebug.php on line 42
SebastianBergmann\CodeCoverage\RuntimeException: xdebug.coverage_enable=On has to be set in php.ini in C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\vendor\phpunit\php-code-coverage\src\Driver\Xdebug.php on line 42
Call Stack:
0.0005 402112 1. {main}() C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\phpunit:0
0.0027 477240 2. require('C:\Users\quent\Desktop\Github\quentingeeraert-website\vendor\symfony\phpunit-bridge\bin\simple-phpunit.php') C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\phpunit:13
0.2824 501760 3. include('C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\phpunit') C:\Users\quent\Desktop\Github\quentingeeraert-website\vendor\symfony\phpunit-bridge\bin\simple-phpunit.php:405
0.2989 1149952 4. PHPUnit\TextUI\Command::main($exit = ???) C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\phpunit:22
0.2989 1150064 5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run($argv = [0 => 'bin\\phpunit', 1 => '--colors=always', 2 => '--stop-on-failure'], $exit = TRUE) C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\src\TextUI\Command.php:162
I already add xdebug.coverage_enable = On in my php.ini file so I don't understand why the system say that :/
Maybe someone can help me ? Thank you a lot for help me !
I already add xdebug.coverage_enable = On in my php.ini file so I don't understand why the system say that :/
Xdebug v3.0.0RC1
PHPUnit 7.5.20
Either upgrade PHPUnit to the version that knows about Xdebug 3 ... or downgrade Xdebug to 2.x (2.9.8 is the latest).
Thing is: xdebug.coverage_enable is the Xdebug 2 option. That option does nothing in Xdebug 3 where you should use xdebug.mode = coverage instead.
Xdebug 3 uses different config options than v2 and your version of PHPUnit is simply not aware of that. Xdebug 3 will simply report an empty value/0 for no-longer-used Xdebug 2 options.
https://3.xdebug.org/docs/upgrade_guide#Changed-Configuration-Settings
P.S. You should see a warning when you run php -i with Xdebug 3 -- it should complain if such a wrong/outdated option is present in your php.ini (unless you have configured PHP to not to report any startup errors I guess).
In either case: run php -i and see the actual live values from Xdebug section: what value that option has.
I have CentOS 6.6 with PHP 5.5.27 and Drupal 7.34
PHP 5.5.27 (cli) (built: Jul 10 2015 23:40:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
I've tried all latest 6,7,8 branches of Drush. When I type "drush -d -v status" I get an unrecoverable error (the error is the same on all branches of drush):
Drush bootstrap phase : bootstrap_drupal_full() [0.19 sec, 5.13 MB] [bootstrap]
Cannot modify header information - headers already sent by (output started at [warning]
/root/.composer/vendor/drush/drush/includes/output.inc:38) common.inc:698 [0.96 sec, 31.89 МБ]
Drush command terminated abnormally due to an unrecoverable error. [1.06 sec, 32.8 МБ]
I can't figure out what's wrong. Can anyone advise please?
Thanks in advance.
As mentioned in another comment, look for closing ?> tags at the end of custom modules, specifically any blank spaces after the >...but just remove the ?> to be in compliance.
A way to fix is to disable module by module until drush gives you a positive response. This will narrow down the code to review.
Also look at any hook_init() functions to see if anything is getting sent to the browser then check the weight of the module in the system table. If it is too low, it may cause an issue.
I have Zend Server CE installed on OS X (10.7.5), I installed PHPUnit via PEAR
$ which pear
/usr/local/zend/bin/pear
$which php
/usr/local/zend/bin/php
$php -v
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
with Zend Extension Manager v6.0.0, Copyright (c) 2003-2013, by Zend Technologies
- with Zend Data Cache v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Job Queue v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Utils v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Optimizer+ v6.0.0, Copyright (c) 1999-2013, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Code Tracing v6.0.0, Copyright (c) 2009-2013, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Monitor v6.0.0, Copyright (c) 1999-2013, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Page Cache v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [disabled]
$ which phpunit
/usr/local/zend/bin/phpunit
But when I execute:
$ phpunit
Inside a test directory (with proper configuration and bootstrapping) I receive the following error:
/usr/local/zend/bin/phpunit: line 2: ?php: No such file or directory
/usr/local/zend/bin/phpunit: line 3: /Applications: is a directory
/usr/local/zend/bin/phpunit: line 4: Bootstrap.php: command not found
/usr/local/zend/bin/phpunit: line 5: syntax error near unexpected token `('
/usr/local/zend/bin/phpunit: line 5: ` * Copyright (c) 2001-2013, Sebastian Bergmann <sebastian#phpunit.de>.'
But if I run:
$ php /usr/local/zend/bin/phpunit
everything works.
Let me expand this a bit:
which phpdoc returns /usr/local/zend/bin/phpdoc but running phpdoc from inside a test folder returns
/usr/local/zend/bin/phpdoc: line 2: ?php: No such file or directory
/usr/local/zend/bin/phpdoc: line 3: /Applications: is a directory
/usr/local/zend/bin/phpdoc: line 4: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 5: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 6: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 7: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 8: syntax error near unexpected token `('
/usr/local/zend/bin/phpdoc: line 8: ` * #copyright 2010-2013 Mike van Riel / Naenius (http://www.naenius.com)'
Any idea why this is happening?