My application generates a PDF file from a webpage using WKHTMLTOPDF tool. Application written with Symfony2 framework and I am using a Symfony2 process to run the shell command to call WKHTMLTOPDF. My command is like below.
C:\wkhtmltopdf\wkhtmltopdf.exe --lowquality --margin-bottom '0' --margin-left '0' --margin-right '0' --margin-top '0' SOURCE.html SOURCE.pdf
This gives me an error now.
Invalid argument(s) parsed to --margin-bottom
is the error I am getting. I am really confused because for some cases it is working perfectly. Only some cases it is not working.
When I try to run the same command in the CMD, it works. Only symfony process gives error.
I really appreciate if anyone can help me.
Related
This is a strange one, I have never come across it before - but then I've not used Symfony 3.1, only 2.8.
When I run a console command such as clear:cache or a doctrine:schema:update, I get the following error on terminal:
PHP Parse error: syntax error, unexpected '[', expecting ')' in
/var/www/vhosts/mycrmsitetest.co.uk/httpdocs/bin/console on line 20
The line its referring to in the console file is:
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
This is exactly the same as on my local drive, but it works there - it's only when it's on the server that this fails.
Does anyone know what this may be?
You need PHP version greater then 5.4. Your script contains the new array syntax ('[]' instead of 'array()'): http://php.net/manual/en/migration54.new-features.php
I am struggling with running new asp.net 5 on my qnap box. As far as I understand it is a strongly modified version of debian.
As part of running installation script I got this error:
-sh: /root/.dnx/dnvm/dnvm.sh: line 616: syntax error near unexpected token `<'
-sh: /root/.dnx/dnvm/dnvm.sh: line 616: read versionOrAlias downloadUrl < <(__dnvm_find_latest "$runtime" "$arch" "$os")'
I run my script bu using script command like:
script /root/.dnx/dnvm/dnvm.sh
as stated in documentation and previous installation script.
By commenting this line out I was able to run whole script but obviously dnvm command does not work properly.
My question is:
What does it do (line with < < syntax) and how do I fix it or rewrite so that my qnap box unix can understand it.
<(...) is Process substitution. /bin/sh doesn't support it, but /bin/bash does. Try changing the shell.
I am trying to build PhantomJS 2.0 on Windows from the c:\fastio\phantomjs\phantomjs directory. For some reason, the build process fails after a while, with 2 errors (see error message below):
1) It tries to access "C:fastiophantomjsphantomjssrcqtqtbasebinmoc.exe". Obviously, the backslash characters between directory names are somehow getting stripped away deep in the build process - possibly a mismatch between Windows-style "\" and Linux-style "/" (but this is only a guess).
2) There's another error, "Failed to read names from file: C:/fastio/phantomjs/phantomjs/src/qt/qtwebkit/Source/WebCore/mathml/mathtags.in".
If I remove sh.exe from the PATH, the build still gets to this point, and only error #2 appears, leading me to think that error #2 is the real problem here.
Here is the full error message (as far as I can tell this is happening while building WebKit):
sh: C:fastiophantomjsphantomjssrcqtqtbasebinmoc.exe: command not found
Failed to read names from file: C:/fastio/phantomjs/phantomjs/src/qt/qtwebkit/Source/WebCore/mathml/mathtags.in at C:/fastio/phantomjs/phantomjs/src/qt/qtwebkit/Source/WebCore/dom/make_names.pl line 315.
NMAKE : fatal error U1077: 'C:\Users\Eugene\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\perl.EXE' : return code '0x7f'
Stop.
(By the way, I saw this question but I'm already past the issues described there, my error is happening later in the build process.)
How can I make this work?
Full logs below:
Console output:
http://pastebin.com/btMeNPz4
QT build log file build_qt_4-285-20-0859.log:
http://pastebin.com/LUEJz7E0
WebKit build log file build_webkit_4-285-20_0859.log:
http://pastebin.com/494TivXF
PhantomJS build log file build_phantomjs_4-285-20_0859.log:
Empty
Looks like I found the solution myself, here were my steps:
Remove as much as possible from the PATH leaving only the entries critical to the build process
Most importantly, remove all GitHub's git directories from the PATH
Install GIT separately (not from GitHub but from git-scm.com), add its cmd directory only (not its bin directory) to the PATH
Install ActivePerl separately, add it to the PATH
It's moving past the error I asked about with the steps above (still not sure if it will finish the build successfully, it's taking a while).
I tried following the SauceLabs PHP tutorial: https://docs.saucelabs.com/tutorials/php/
I tried to make it run on Windows. So I followed every step until I have to run this command:
vendor\bin\phpunit.bat WebDriverDemo.php
This generates an error: Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in C:\xampp\htdocs\sauce-tutorial\vendor\sauce\sausage\src\Sauce\Sausage\WebDriverTestCase.php
on line 6
So I tried looking at WebDriverTestCase.php on line 6 and this is the code:
namespace Sauce\Sausage;
abstract class WebDriverTestCase extends \PHPUnit_Extensions_Selenium2TestCase
{
use TestCase; // this is line 6
}
Whats wrong with this code? I changed nothing, I only tried to run what the tutorial suggests. Any ideas?
I don't use PHP but on the basis of what I found with a Google search, I'd suggest making sure you are running the code with PHP 5.4 or later. In the cases I found on the web using an older version of PHP seemed to be the cause of that error.
I have developed a Symfony2 project (v2.2.2) and it was working all fine locally.
When I deploy it on my server I meet 2 issues:
the folder /bin does not transfer through Filezilla (impossible to start transfer)
i encounter a parse error when trying to access web/app.php/ in debug mode (see below)
First I do not understand why it would work in local but not on production.
I also guessed these errors where linked but I do not know what is /bin used for (contains only 2 files doctrine and doctrine.php) and if I remove it locally it keeps working ...
Parse error is the following :
"FatalErrorException: Parse: syntax error, unexpected '[' in /home/colocall/twinkler/src/Tk/ExpenseBundle/Services/Expenses.php line 21"
Expenses.php line 15->25:
public function getAllExpenses($member, $group)
{
$all_expenses_col = $group->getExpenses();
$all_expenses = array();
foreach($all_expenses_col as $expense){
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
}
return $all_expenses;
}
Maybe linked to : The parse error also happen when i try to update my database through ssh connection.
If someone would know the reason why I can't make it working it would save my day that i have already lost ...
Thank you in advance,
Jules
Your error is produced by using the short array syntax [] in your code.
It is not available in PHP 5.3.10 aka on your production server. The short syntax was introduced in PHP 5.4 which explains why your code is working in your dev-environment.
change ...
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
...to
$all_expenses[] = array($expense, $this->forYou($member, $expense));
... or update your server's php version and it will work :)