Im starting a project with autodesk forge in PHP, but I got an arror that I cant solve. I did everything in this site https://learnforge.autodesk.io/#/environment/setup/2legged to create a server in PHP and Node.js. In node I got success but my friends want to make it in php.
Got 2 errors and I solve one:
The first one was:
HP Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::create() must be an instance of Dotenv\Repository\RepositoryInterface, string given, called in /Users/.../forgeExample/server/config.php on line 14 and defined in /Users/.../forgeExample/vendor/vlucas/phpdotenv/src/Dotenv.php:83
Stack trace:
#0 /Users/.../forgeExample/server/config.php(14): Dotenv\Dotenv::create('/Users/mackleym...')
#1 /Users/.../forgeExample/server/oauth.php(14): Autodesk\ForgeServices\ForgeConfig::getForgeID()
#2 /Users/.../forgeExample/server/oauth.php(49): Autodesk\ForgeServices\AuthClientTwoLegged->__construct()
#3 /Users/.../forgeExample/index.php(8): include_once('/Users/mackleym...')
#4 {main}
thrown in /Users/.../forgeExample/vendor/vlucas/phpdotenv/src/Dotenv.php on line 83
I solve this with the help in vlucas/phpdotenv by changing the line 14 in server/config.php from:
$dotenv = Dotenv::create(__DIR);
to $dotenv = Dotenv::createImmutable(__DIR__);
The server runs and stops loading the exemple with this second error:
PHP Fatal error:
Uncaught Autodesk\Core\Exception\RuntimeException: The client_id specified does not have access to the api product in /Users/mackleymagalhaes/development/.../forgeExample/vendor/autodesk/core/lib/Auth/TokenFetcher.php:108
Stack trace:
#0 /Users/mackleymagalhaes/development/.../forgeExample/vendor/autodesk/core/lib/Auth/TokenFetcher.php(87): Autodesk\Auth\TokenFetcher->makeRequest('https://develop...', Array)
#1 /Users/mackleymagalhaes/development/.../forgeExample/vendor/autodesk/core/lib/Auth/OAuth2/AbstractOAuth2.php(143): Autodesk\Auth\TokenFetcher->fetch('https://develop...', 'client_credenti...', Array, Array)
#2 /Users/mackleymagalhaes/development/.../forgeExample/vendor/autodesk/core/lib/Auth/OAuth2/TwoLeggedAuth.php(15): Autodesk\Auth\OAuth2\AbstractOAuth2->fetchAccessToken('authentication/...', 'client_credenti...')
#3 /Users/mackleymagalhaes/development/.../forgeExample/server/oauth.php(38): Autodesk\Auth\OAuth2\TwoLeggedAuth->fetchToken()
#4 /Users/mackleymagalhaes/developme in /Users/mackleymagalhaes/development/.../forgeExample/vendor/klein/klein/src/Klein/Klein.php on line 954
[Thu Sep 3 16:59:07 2020] [::1]:58380 [200]: GET /api/forge/oss/buckets?id=%23 - Uncaught Autodesk\Core\Exception\RuntimeException: The client_id specified does not have access to the api product in /Users/mackleymagalhaes/development/.../forgeExample/vendor/autodesk/core/lib/Auth/TokenFetcher.php:108
Stack trace:
#0 /Users/mackleymagalhaes/development/.../forgeExample/vendor/autodesk/core/lib/Auth/TokenFetcher.php(87): Autodesk\Auth\TokenFetcher->makeRequest('https://develop...', Array)
#1 /Users/.../forgeExample/vendor/autodesk/core/lib/Auth/OAuth2/AbstractOAuth2.php(143): Autodesk\Auth\TokenFetcher->fetch('https://develop...', 'client_credenti...', Array, Array)
#2 /Users/.../forgeExample/vendor/autodesk/core/lib/Auth/OAuth2/TwoLeggedAuth.php(15): Autodesk\Auth\OAuth2\AbstractOAuth2->fetchAccessToken('authentication/...', 'client_credenti...')
#3 /Users/.../forgeExample/server/oauth.php(38): Autodesk\Auth\OAuth2\TwoLeggedAuth->fetchToken()
#4 /Users/mackleymagalhaes/developme in /Users/mackleymagalhaes/development/.../forgeExample/vendor/klein/klein/src/Klein/Klein.php on line 954
anyone know what is this?
after downgrade my version of vlucas/phpdoenv to ^3.0.0 I`ve got this errors on console:
[Tue Sep 8 12:12:13 2020] [404] /api/forge/oss/buckets - No such file
or directory [Tue Sep 8 09:12:14 2020] PHP Fat al error: Uncaught
Autodesk\Forge\Client\ApiException: [403] Error connecting to the API
(https://developer.api.autodesk.com/oss/v2/buckets) in
..\forge-example2\vendor\autodesk\forge-client\lib\ApiClient.php:261 S
tack trace:
#0 ..\forge-example2\vendor\autodes k\forge-client\lib\Api\AbstractApi.php(89):
Autodesk\Forge\Client\ApiClient->callApi('/oss/v2/buckets', 'GET',
Array, '', Array, '\Autodesk\Forge...', '/oss/v 2/buckets')
#1 ..\forge-example2\vendor\autodesk\forge-cl ient\lib\Api\BucketsApi.php(390):
Autodesk\Forge\Client\Api\AbstractApi->callApi('/oss/v2/ buckets',
'GET', Array, '', Array, '\Autode sk\Forge...', '/oss/v2/buckets')
#2 ..\forge-example2\vendor\autodesk\forge-client\lib\Api \BucketsApi.php(330):
Autodesk\Forge\Client\Api\BucketsApi->getBucketsWithH ttpInfo(NULL,
NULL, NULL)
#3 ..\forge- example2\server\oss.php(47): Autodesk\Forge\Client\Api\BucketsApi->getBuckets()
#4 D:\UFU\for ge-example2\index.php(26): Autodesk\ForgeS ervices\DataManagement->getBucketsAndObjects()
#5 [internal fun in ..\forge-example2\vendor\klein\klein\src\Klein\Klein.php on line 954
[Tue Sep 8 09:12:14 2020] [::1]:54087 [200]: GET
/api/forge/oss/buckets?id=%23 - Uncaught
Autodesk\Forge\Client\ApiException: [403 ] Error connecting to the API
(https://developer.api.autodesk.com/oss/v2/buckets) in D:\UFU\forge-
example2\vendor\autodesk\forge-client\lib\Ap iClient.php:261 Stack
trace:
#0 ..\forge-example2\vendor\autodesk\forge-client\lib\Api \AbstractApi.php(89): Autodesk\Forge\C
lient\ApiClient->callApi('/oss/v2/buckets', 'GET', Array, '', Array,
'\Autodesk\Forge...', '/oss/v2/buckets')
#1 ..\forge-exam ple2\vendor\autodesk\forge-client\lib\Api\BucketsApi.php(390):
Autodesk\Forge\Client\Api\Abst ractApi->callApi('/oss/v2/buckets',
'GET', Array, '', Array, '\Autodesk\Forge...', '/oss/v2/b uckets')
#2 ..\forge-example2\vendor\auto desk\forge-client\lib\Api\BucketsApi.php(330):
Autodesk\Forge\Client\Api\BucketsApi->getBuc ketsWithHttpInfo(NULL,
NULL, NULL)
#3 ..\forge-example2\server\oss.php(47): Autodesk\Forge\Client\Api\BucketsApi->getBuckets()
#4 ..\forge-example2\index.php(26): Aut odesk\ForgeServices\DataManagement->getBucketsAndObjects()
#5 [internal fun in D:\UFU\forge-ex ample2\vendor\klein\klein\src\Klein\Klein.php on line 954
[Tue Sep 8 09:12:14 2020] [::1]:54087 Closing
I ran into the same issue, and in my case it ended up being some version mismatch of the vlucas/phpdotenv dependency. Here's what I did to get the PHP sample working (in the project's root folder, using bash):
# confirm you have a good version of PHP (in my case it's 7.3.11)
php -v
# remove composer dependencies
rm -rf vendor
rm composer.lock
# setup composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar install
# create the .env file
cp server/.env.example server/.env
vim server/.env # add your client ID and client secret
# start the app
php -S localhost:3000 -t .
# now, open your browser and go to http://localhost:3000/www/index.html
Related
The website randomly went down and I can't figure out how to correct the following error. I have tried toggling all plugins, the server was recently updated to PHP 7.4 from PHP 7.3 but no other website has had this issue.
My Setup:
PHP - PHP 7.4.11 (cli) (built: Oct 8 2020 17:32:43)
uname - Debian 4.19.146-1 (2020-09-17) x86_64 GNU/Linux
MySQL - mysql Ver 15.1 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Error from the website:
Fatal error: Uncaught Error: Call to undefined function wp_cache_add()
in /WEBSITE_PATH/wp-includes/option.php:258 Stack trace: #0
/WEBSITE_PATH/wp-includes/functions.php(1717): wp_load_alloptions() #1
/WEBSITE_PATH/wp-includes/load.php(664): is_blog_installed() #2
/WEBSITE_PATH/wp-settings.php(159): wp_not_installed() #3
/WEBSITE_PATH/wp-config.php(99): require_once('/home/swcsoldie...') #4
/WEBSITE_PATH/wp-load.php(37): require_once('/home/swcsoldie...') #5
/WEBSITE_PATH/wp-blog-header.php(13):
require_once('/home/swcsoldie...') #6 /WEBSITE_PATH/index.php(22):
require('/home/swcsoldie...') #7 {main} thrown in
/WEBSITE_PATH/wp-includes/option.php on line 258
Fatal error: Uncaught Error: Call to undefined function wp_cache_add()
in /WEBSITE_PATH/wp-includes/option.php:258 Stack trace: #0
/WEBSITE_PATH/wp-includes/option.php(116): wp_load_alloptions() #1
/WEBSITE_PATH/wp-includes/l10n.php(69): get_option() #2
/WEBSITE_PATH/wp-includes/l10n.php(137): get_locale() #3
/WEBSITE_PATH/wp-includes/l10n.php(828): determine_locale() #4
/WEBSITE_PATH/wp-includes/class-wp-fatal-error-handler.php(46):
load_default_textdomain() #5 [internal function]:
WP_Fatal_Error_Handler->handle() #6 {main} thrown in
/WEBSITE_PATH/wp-includes/option.php on line 258
Code from Line 258:
wp_cache_add( 'alloptions', $alloptions, 'options' );
An undefined function error in PHP is fatal error, and means you're calling a function that doesn't exist (at least, at the point and scope it's being called at). Most often, I'd wager 9/10 times, this happens while you're developing and you mistype a function name, str_repace instead of str_replace, for instance.
With all of that being said, wp_cache_add() is a WordPress Core function defined in /wp-includes/cache.php, and is being called by a core file: /wp-includes/option.php on line 258.
Since these core files, and core functions are triggering a fatal "undefined function" error, it means your WordPress installation is failing somewhere. It possibly got corrupted during an update of some kind - it's infrequent, but it does happen for any number of reasons.
To fix this: try reinstalling WordPress, as it is absolutely compatible with PHP 7.4.
I have a laravel project I installed the composer
and run
composer install
After that I executed the update command
composer update
on the project's root directory, and during the execution on the command
php artisan optimize
I got the error shown in the attached image.
When I try to execute any php artisan command I got the same error too.
Error lines
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#2 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#4 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
You could try to use the append_config() helper method in your environment app configuration file:
'providers' => append_config(array(
'LocalOnlyServiceProvider',
))
The command php artisan optimize has been remove in laravel 5.6
see more: https://laravel.com/docs/5.6/upgrade
I recently moved my Laravel 5.3.1 (Repository pattern) project from Windows 10 to Ubuntu 16.04LTs. When I update the composer, I'm getting the following errors.
Illuminate\Foundation\ComposerScripts::postUpdate
PHP Warning: Uncaught ErrorException: require(/opt/lampp/htdocs/new-abc.test.lk): failed to open stream:
Success in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php:55
Stack trace:
#0 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
Composer\Util\ErrorHandler::handle(2, 'require(/opt/la...',
'/opt/lampp/htdo...', 55, Array)
#1 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
require()
#2 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(45):
composerRequirecf118caaa79186b36c4e6ab213835334('efaf82f485f314c...',
'/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/new-abc.test.lk/vendor/autoload.php(7): ComposerAutoloaderInitcf118caaa79186b36c4e6ab213835334::getLoader()
#4 /opt/lampp/htdocs/new-abc.test.lk/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(30):
require_once('/opt/lampp/htdo...')
#5 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(238):
Illuminate\Foundation\Comp in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
Warning: Uncaught ErrorException: require(/opt/lampp/htdocs/new-abc.test.lk): failed to open stream:
Success in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php:55
Stack trace:
#0 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
Composer\Util\ErrorHandler::handle(2, 'require(/opt/la...',
'/opt/lampp/htdo...', 55, Array)
#1 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
require()
#2 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(45):
composerRequirecf118caaa79186b36c4e6ab213835334('efaf82f485f314c...',
'/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/new-abc.test.lk/vendor/autoload.php(7): ComposerAutoloaderInitcf118caaa79186b36c4e6ab213835334::getLoader()
#4 /opt/lampp/htdocs/new-abc.test.lk/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(30):
require_once('/opt/lampp/htdo...')
#5 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(238):
Illuminate\Foundation\Comp in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
PHP Fatal error: composerRequirecf118caaa79186b36c4e6ab213835334(): Failed opening
required '/opt/lampp/htdocs/new-abc.test.lk/'
(include_path='.:/usr/share/php') in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
Fatal error: composerRequirecf118caaa79186b36c4e6ab213835334(): Failed opening required '/opt/lampp/htdocs/new-abc.test.lk/'
(include_path='.:/usr/share/php') in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
What I tried:
Removing the existing vendor folder
Removing the composer.lock file
Any help would be appreciated.
The problem was caused due to the case sensitive issue. I think windows have neglected but Linux didn't.
What I've done is, I've created a custom helper file and included in the composer.json.
The mistake was the actual filename case sensitive didn't match the included file in the composer.json.
When running composer install I get the following error:
php artisan clear-compiled
PHP Fatal error: Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/courtesy-sys/app/Exceptions/Handler.php:25
Stack trace:
#0 /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown in /home/vagrant/Code/courtesy-sys/app/Exceptions/Handler.php on line 25
[Symfony\Component\Debug\Exception\FatalErrorException]
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/courtesy-sys/app/Exceptions/Handler.php:25
Stack trace:
#0 /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown
Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255
Is there someone with a similar problem and can provide me with the solution. I tried Google without any results...
Try it:
composer install --no-scripts
I have Fedora18 and was trying to install cakephp . But it shows
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www/html/cakem2/lib/Cake/Cache/Cache.php on line 323
Warning: /var/www/html/cakem2/app/tmp/cache/persistent/ is not writable in /var/www/html/cakem2/lib/Cake/Cache/Engine/FileEngine.php on line 385
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /var/www/html/cakem2/lib/Cake/Cache/Cache.php:181 Stack trace: #0 /var/www/html/cakem2/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #1 /var/www/html/cakem2/app/Config/core.php(374): Cache::config('_cake_core_', Array) #2 /var/www/html/cakem2/lib/Cake/Core/Configure.php(72): include('/var/www/html/c...') #3 /var/www/html/cakem2/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) #4 /var/www/html/cakem2/app/webroot/index.php(94): include('/var/www/html/c...') #5 /var/www/html/cakem2/index.php(41): require('/var/www/html/c...') #6 {main} thrown in /var/www/html/cakem2/lib/Cake/Cache/Cache.php on line 181
Following the answers Similar Question, I have made all the directory and sub-directory writable as shown in . But I am still getting the error ! Whats wrong ?
chown the folders / files so that the user matches the user which httpd or Apache uses to access these files. I don't know the user for fedora, i think its apache or httpd. In ubuntu its www-data.
http://fedoraproject.org/wiki/Administration_Guide_Draft/Apache