phantomJs permission denied - php

Have a question and I have the feeling it should not be to hard to solve but I'm not really familiar with Phantom Js.
$this->phantomProcess($path)->setTimeout(10)->mustRun();
This line results in the following error:
protected function captureImage($view)
{
$path = $this->writeFile($view);
$this->phantomProcess($path)->setTimeout(10)->mustRun();
return $path;
}
protected function writeFile($view)
{
file_put_contents($path = 'storage/' . md5(uniqid()) . '.pdf' , $view);
return $path;
}
protected function phantomProcess($path)
{
return new Process('bin/phantomjs capture.js ' . $path);
}
I'm running the following line:
Fatal error: Uncaught exception 'Symfony\Component\Process\Exception\ProcessFailedException' with message 'The command "bin/phantomjs capture.js storage/7c5b791a0c1f131aac5c5ca272a1c891.pdf" failed. Exit Code: 126(Invoked command cannot execute) Working directory: /Applications/XAMPP/xamppfiles/htdocs/pdf Output: ================ Error Output: ================ sh: bin/phantomjs: cannot execute binary file ' in /Applications/XAMPP/xamppfiles/htdocs/pdf/vendor/symfony/process/Process.php:239 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/pdf/app/Codecourse/Capture/Capture.php(45): Symfony\Component\Process\Process->mustRun() #1 /Applications/XAMPP/xamppfiles/htdocs/pdf/app/Codecourse/Capture/Capture.php(24): Codecourse\Capture\Capture->captureImage('<!DOCTYPE html>...') #2 /Applications/XAMPP/xamppfiles/htdocs/pdf/index.php(17): Codecourse\Capture\Capture->load('invoice.php', Array) #3 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/pdf/vendor/symfony/process/Process.php on line 239
Anybody who can help me out?
Really appreciated,

Related

phpmyadmin blank page - getCookie error when 'php index.php'

when accessing the www.hostname/phpmyadmin/ page i get the blank page. Tried to reinstall PHP,HTTPD and MYSQL.
After running php index.php in the phpmyadmin folder I get the following error:
[root#ansible1 phpmyadmin]# php index.php
PHP Fatal error: Uncaught Error: Call to a member function getCookie() on null in /usr/share/phpmyadmin/libraries/classes/Url.php:219
Stack trace:
#0 /usr/share/phpmyadmin/libraries/classes/Url.php(171): PhpMyAdmin\Url::getCommonRaw(Array, '?')
#1 /usr/share/phpmyadmin/libraries/classes/Core.php(762): PhpMyAdmin\Url::getCommon(Array)
#2 /usr/share/phpmyadmin/libraries/classes/Core.php(338): PhpMyAdmin\Core::linkURL('https://secure....')
#3 /usr/share/phpmyadmin/libraries/classes/Core.php(364): PhpMyAdmin\Core::getPHPDocLink('book.json.php')
#4 /usr/share/phpmyadmin/libraries/classes/Core.php(1006): PhpMyAdmin\Core::warnMissingExtension('json', true)
#5 /usr/share/phpmyadmin/libraries/common.inc.php(110): PhpMyAdmin\Core::checkExtensions()
#6 /usr/share/phpmyadmin/index.php(23): require_once('/usr/share/phpm...')
#7 {main}
thrown in /usr/share/phpmyadmin/libraries/classes/Url.php on line 219
On the line 219 in the corresponding file:
public static function getCommonRaw($params = [], $divider = '?')
{
/** #var Config $PMA_Config */
global $PMA_Config;
$separator = Url::getArgSeparator();
// avoid overwriting when creating navi panel links to servers
if (isset($GLOBALS['server'])
&& $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']
&& ! isset($params['server'])
&& ! $PMA_Config->get('is_setup')
) {
$params['server'] = $GLOBALS['server'];
}
if (empty($PMA_Config->getCookie('pma_lang')) && ! empty($GLOBALS['lang'])) {
$params['lang'] = $GLOBALS['lang'];
}
$query = http_build_query($params, '', $separator);
if ($divider != '?' || strlen($query) > 0) {
return $divider . $query;
}
Not sure what I am doing wrong but havent found this error on the internet....
The blowfish secret is set:
$cfg['blowfish_secret'] = 'H2OxcGXxflSd8JwrwVlh6KW6s2rER63i';
Any idea what could I be missing? Even a hint what direction to look will be appreciated.
EDIT1:
Downgraded to version 4.9.4 - getting the similar error:
So after downgrading to version 4.9.4 I get the very similar....
[root#ansible1 phpmyadmin]# php index.php
PHP Fatal error: Uncaught Error: Call to a member function getCookie() on null in /usr/share/phpmyadmin/libraries/classes/Url.php:217
Stack trace:
#0 /usr/share/phpmyadmin/libraries/classes/Url.php(169): PhpMyAdmin\Url::getCommonRaw(Array, '?')
#1 /usr/share/phpmyadmin/libraries/classes/Core.php(749): PhpMyAdmin\Url::getCommon(Array)
#2 /usr/share/phpmyadmin/libraries/classes/Core.php(330): PhpMyAdmin\Core::linkURL('https://secure....')
#3 /usr/share/phpmyadmin/libraries/classes/Core.php(353): PhpMyAdmin\Core::getPHPDocLink('book.json.php')
#4 /usr/share/phpmyadmin/libraries/classes/Core.php(987): PhpMyAdmin\Core::warnMissingExtension('json', true)
#5 /usr/share/phpmyadmin/libraries/common.inc.php(106): PhpMyAdmin\Core::checkExtensions()
#6 /usr/share/phpmyadmin/index.php(27): require_once('/usr/share/phpm...')
#7 {main}
thrown in /usr/share/phpmyadmin/libraries/classes/Url.php on line 217
The page now shows: Access Denied - simply written, no pictures or anything.
What am I missing? :/
[Browser view1
I don't know if my previous post is visible, so I post it again:
I had the same error message, and row #4 says: "PhpMyAdmin\Core::warnMissingExtension('json', true)".
After installing php-json package, problem was solved for me.

I can't solve this Fatal error problem with pdfMerger

I'm trying to merge some pdf's, but I have a problem that I can't understand and I don't know what's happening, Can someone help me?
Attached code in PHP
This is the method for pdfMerger
public static function pdfMerger($archivos, $destino){
$pdf = new PDFMerger(); // or use $pdf = new \PDFMerger; for Laravel
if($archivos != null){
for($i=0; $i < count($archivos); $i++){
$pdf->addPDF($archivos[$i], 'all');
}
}
$pdf->merge('file', $destino);
}
And here is where I'm calling the method:
//This is a test
$control = new FilesController();
$dir = "/Jomar/induccion/documents/";
$files = glob($_SERVER['DOCUMENT_ROOT']."{$dir}politicas empresa/*.pdf");
$url = $_SERVER['DOCUMENT_ROOT']."{$dir}politicas empresa/prueba.pdf";
print_r($files);
$control->pdfMerger($files, $url);
This is the error I'm currently receiving:
Fatal error: Uncaught Exception: TCPDF_PARSER ERROR: decodeFilterFlateDecode: invalid code in C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php:474 Stack trace: #0 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php(359): TCPDF_FILTERS::Error('decodeFilterFla...') #1 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php(94): TCPDF_FILTERS::decodeFilterFlateDecode('\xEA\x91\xB9mj/\xAB\x8E;iN\xA3\x143\xAF...') #2 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\tcpdi_parser.php(1310): TCPDF_FILTERS::decodeFilter('FlateDecode', '\xEA\x91\xB9mj/\xAB\x8E;iN\xA3\x143\xAF...') #3 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\tcpdi_parser.php(1249): tcpdi_parser->_rebuildContentStream(Array) #4 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\tcpdi.php(192): tcpdi_parser->getContent() #5 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\PDFMerger.php(104): TCPDI->importPage(1) in C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php on line 474
(Sorry for my english)
The problem was of the permissions of the pdf, therefore, is necessary to check that in the pdf document doesn't have any type of restrictions. thanks for your help.

Autoload error in php

I am trying autoload function in php. The files are all in the same directory.
I have a file called aviation.php with the following code:
class Avaitor{
public function __construct(){
echo "Fly high<br>";
}
}
Then in my autoloader file I am trying to do this:
function __autoload($fileName){
if(file_exists($fileName . ".php"))
require_once $fileName . ".php";
}
//require_once "aviatior.php";
$pilot = new Avaitor();
But I am getting this error:
Fatal error: Uncaught Error: Class 'Avaitor' not found in
/Applications/MAMP/htdocs/php_oop/autoload.php:22 Stack trace: #0
{main} thrown in /Applications/MAMP/htdocs/php_oop/autoload.php on
line 22
Just to test that require_once does find my aviator.php I tried it out and then commented it out.
What am I doing wrong here?

Uncaught exception 'Exception' with message ' * GET Property login does not exist' can any one give me the solution

am gettiing this error
Fatal error:
Uncaught exception 'Exception' with message ' * GET Property login
does not exist' in
E:\xampp\htdocs\UniversityWork\Project\UniversityProjectPHP\model\Checkout.php:30
Stack trace: #0
E:\xampp\htdocs\UniversityWork\Project\UniversityProjectPHP\views\top.php(44):
Checkout->__get('login') #1
E:\xampp\htdocs\UniversityWork\Project\UniversityProjectPHP\checkout.php(9):
require_once('E:\xampp\htdocs...') #2 {main} thrown in
E:\xampp\htdocs\UniversityWork\Project\UniversityProjectPHP\model\Checkout.php
on line 30
line 44 look like this
if ($obj_user->login && in_array($current, $public_pages)) {
$_SESSION['ref_url'] = $url;
$_SESSION['msg'] = "You must <a href='" . BASE_URL . "process/process_logout.php'>LOGOUT</a> to view this page";
header("Location:" . BASE_URL . "msg.php");
}
line 30 look like
public function __get($name) {
$method_name = "get_$name";
if (!method_exists($this, $method_name)) {
**throw new Exception(" * GET Property $name does not exist");**
}
return $this->$method_name();
}
line number 9 look like this
<title> Home shop || Checkout </title>
<?php
require_once 'model/user.php';
require_once 'model/brand.php';
require_once 'model/Checkout.php';
require_once 'model/product.php';
require_once 'model/cart.php';
require_once 'model/category.php';
**require_once 'views/top.php';**
require_once 'model/web_interface.php';
?>
This part of your code:
if ($obj_user->login
is trying to read the property login of the $obj_user object, but it does not have the get_login property read-accessor.
Much more than that I cannot say from the information you posted.

SOAP request not working in PHP

We have wsdl :
http://xxxxxxxxxxxxxxx.com/XXXX_Beta_3_API/webservice.asmx?wsdl
IN PHP FILE : i have created a Class with some arrays in it..
class Crmtet {
public $abc;
public $abc2;
public $abc3;
public $abc4;
}
$client = new SoapClient(http://xxxxxxxxxxxxxxx.com/XXXX_Beta_3_API/webservice.asmx?wsdl);
$obj = new Crmtet();
$obj->abc= "Test";
$obj->abc2= "Test2";
$obj->abc3= "Test3";
$obj->abc4= "Test4";
$result = $client->CRM_Warehouse_Master_Insert($obj)->CRM_Warehouse_Master_InsertResult;
echo"re".$result;
But i am getting below error :
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was
unable to process request. ---> Object reference not set to an
instance of an object. in
E:\EasyPHP-12.1\www\test\inserwarrecrm.php:60 Stack trace: #0
E:\EasyPHP-12.1\www\test\inserwarrecrm.php(60):
SoapClient->__call('CRM_Warehouse_M...', Array) #1
E:\EasyPHP-12.1\www\test\inserwarrecrm.php(60):
SoapClient->CRM_Warehouse_Master_Insert(Object(Crmtet)) #2 {main}
thrown in E:\EasyPHP-12.1\www\test\inserwarrecrm.php on line 60
What is the issue.. can anyone help..??

Categories