I’m interested in trying cloudconvert with php, but I can’t get it to work. I put the phar file in the same folder as index.php but when I’m running this code I get the error message below.
What’s wrong?
<?php
require 'phar://cloudconvert-php.phar/vendor/autoload.php';
use \CloudConvert\Api;
$api = new Api(“my_api_key”);
Warning: require(phar://cloudconvert-php.phar/vendor/autoload.php):
failed to open stream: phar error: invalid url or non-existent phar
"phar://cloudconvert-php.phar/vendor/autoload.php" in
/Library/WebServer/Documents/index.php on line 2
Fatal error: require(): Failed opening required
'phar://cloudconvert-php.phar/vendor/autoload.php' (include_path='.:')
in /Library/WebServer/Documents/index.php on line 2
I'm not into cloudconvert but this is what I read ...
You actually not loading a phar ... You try to load the autoload.php...
Assuming cloudconvert-php.phar/vendor/autoload.php is your full path
your should do:
require('cloudconvert-php.phar/vendor/autoload.php')
Related
I have [root]/includes/helpdesk/pipe.php with this code:
#!/opt/cpanel/ea-php55/root/usr/bin/php
<?php
require_once("pipeprocess.php");
In the same location in pipeprocess.php in first line I include another file still in the same location: helpdesk.php
then in [root]/includes/helpdesk/helpdesk.php in the first line I have:
require_once ("../../config.php");
config.php is in [root], this is why I have twice ../../, helpdesk.php works fine with direct access, but if run pipe.php via pipe command setup in cPanel I get a bounce error that config. php is not found:
PHP Warning: require_once(../../config.php): failed to open stream:
No such file or directory in
/home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on line
21
Warning: require_once(../../config.php): failed to open stream: No
such file or directory in
/home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on line
21 PHP Fatal error: require_once(): Failed opening required
'../../config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
in /home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on
line 21
Fatal error: require_once(): Failed opening required
'../../config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
in /home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on
line 21
Why I am getting this pipe error as direct access to helpdesk.php works fine? does pipe not accept ../ or ../../ as parth of the path? or is there an EasyApache4 issue? I did several tests and noticed this is because of ../ as part of including path. Does pipe/EasyApache4 have problem with this?
What if you used __DIR__, based on where your currently running script file's folder?
As of PHP 5.3.0, you could use something like this:
require_once (__DIR__ . "/../../config.php");
I installed the pear/http_request2 version 2.2.1 using Composer in my project but when I am trying to make my first request I am getting this Warning and Fatal error:
Warning: require_once(Net/URL2.php): failed to open stream: No such
file or directory in
/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php
on line 24
Fatal error: require_once(): Failed opening required 'Net/URL2.php'
(include_path='/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/pear_exception:.:/Applications/XAMPP/xamppfiles/lib/php')
in
/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php
on line 24
I appreciate any help on how to fix it, thanks in advance.
David.
This should work:
composer require pear/http_request2:2.2.1
By default pear/net_url2 should be installed which has the required URL2.php file (./vendor/pear/net_url2/Net/URL2.php).
Then make sure you're including vendor/autoload.php file in your scripts to load automatically the include paths (see: vendor/composer/include_paths.php file).
Here is a simple PHP command to test this out:
php -r 'require_once "vendor/autoload.php"; require_once "Net/URL2.php";'
Note: The above command should run without any errors.
Related: Errors in the autoloaded HTTP/Request2 code, how to troubleshoot composer?
You need HTTP_Request2 from git master, because it has not been released/tagged yet at the time of writing.
I'm getting this error:
Warning: require(/home/wiseman/public_html/path/to/facebook-php-sdk-v4/autoload.php): failed to open stream: No such file or directory in /home/wiseman/public_html/facebook.php on line 3
Fatal error: require(): Failed opening required '/home/wiseman/public_html/path/to/facebook-php-sdk-v4/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wiseman/public_html/facebook.php on line 3
The sdk has been installed by the host server and I can see the autoload file in exactly the path it's looking for. Anyone know what the problem could be? I'm new to working with facebook and am really green so be gentle! :)
I have downloaded the Twilio PHP library but I am getting an error when I try to include the library in my code.
Below is the error I get:
Warning: require(twilio-lib.php) [function.require]: failed to open stream: No such file or directory in /websites-dev/dev.icalapp.rogersdigitalmedia.com/testing.php on line 11
Fatal error: require() [function.require]: Failed opening required 'twilio-lib.php' (include_path='.:/usr/share/pear:/usr/share/php') in /websites-dev/dev.icalapp.rogersdigitalmedia.com/testing.php on line 11
Someone fudged up somewhere - there is no such twilio-lib.php file in Twilio's PHP library.
Try removing the line in your downloaded PHP that looks exactly or similar to the following:
require "twilio-lib.php";
I configured the external tool correctly. As soon as I start to run a test case I get this error:
Failed loading C:\PHP\5.2.13\ext\php_xdebug.dll
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/PHP/5.2.13/ext\php_oci8.dll' - The specified module could not be found. in Unknown on line 0
PHP Warning: require_once(../../../application/cl/Dict.inc): failed to open stream: No such file or directory in C:\xxx\abc\abbb\application\cl\DictTest.php on line 5
PHP Fatal error: require_once(): Failed opening required '../../../application/cl/Dict.inc' (include_path='.;C:\PHP\5.2.13\pear\') in C:\xxx\abc\abbb\application\cl\DictTest.php on line 5
What could it be?
I can assure this is due to installation path problems.
Did you install phpUnit through pear or separately? if you have installed by PEAR, did you set up the PEAR path in php.ini file?