Mirror API database access issue - php

I just installed the Google mirror API. I have everything setup except after I log in to the API, I get this error message:
Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\mirror-client.php on line 33
Fatal error: Uncaught exception 'Exception' with message 'Unable to open database: unable to open database file' in C:\xampp\htdocs\util.php:62 Stack trace: #0 C:\xampp\htdocs\util.php(62): SQLite3->__construct('/tmp/database.s...') #1 C:\xampp\htdocs\util.php(26): init_db() #2 C:\xampp\htdocs\oauth2callback.php(41): store_credentials('107736579479351...', '{"access_token"...') #3 {main} thrown in C:\xampp\htdocs\util.php on line 62
It seems that the API can't create the database or do I need to create it?
I tried making a folder and database as it is set up in the config.php file "tmp/database.sqlite" but no luck.
Any ideas?

I figured out that you had to make your own database for it to work.

It can mean that the directory/folder you placed the sqlite file in (and the file itself) does not have the correct permissions. You need to make sure both the folder and the file have read and write permissions. The xampp directory in my environment has read/write permissions. You might want to place your database there, at least for testing purposes.
Note: The /tmp directory as mentioned in "/tmp/database.sqlite" is a Linux/Mac directory. You may want to change the value of $sqlite_database in the config.php file to point to a file in a Windows directory.

Related

Error code: ddlxmlfileerror during plugin installation

I have created a plugin/webservice in moodle in my local folder in moodle, when i converted the folder to zip and then installed it; it would install correctly in local folder in moodle. Now i want to install it in the mod folder so i changed the path from local to mod everywhere in my plugin and now when i try installing i get the following error.
XML database file errors found
More information about this error
Debug info: File does not exist
Error code: ddlxmlfileerror
Stack trace:
line 346 of \lib\ddl\database_manager.php: ddl_exception thrown
line 370 of \lib\ddl\database_manager.php: call to database_manager->load_xmldb_file()
line 841 of \lib\upgradelib.php: call to database_manager->install_from_xmldb_file()
line 576 of \lib\upgradelib.php: call to upgrade_plugins_modules()
line 1929 of \lib\upgradelib.php: call to upgrade_plugins()
line 713 of \admin\index.php: call to upgrade_noncore()
I don't want to add anything to the database when installing my plugin, i even created an empty install.xml but i get a different error i.e.
Debug info: Errors found in XMLDB file: Missing TABLES section
Error code: ddlxmlfileerror
Can anyone provide me with a solution, Thank you in advance.
Activity plugins are not the same as local plugins.
With local plugins you can do pretty much anything you like.
But Activity plugins have a lot of requirements - including a main database table which is the same name as the plugin. So you will need to create an install.xml file.
There is documentation here on creating an activity plugin.
https://docs.moodle.org/dev/Activity_modules#install.xml

Error Accessing Zend Server Web-Interface, "gui directive not found: zend"

I have a problem with Zend Server (2019.0.4). When I try to access the web-based interface it gives me HTTP 500. The exact error in the php.log file is this:
[07-Jan-2022 18:49:12 UTC] PHP Fatal error: Uncaught ZendServer\Exception: gui directive not found: zend in C:\Program Files (x86)\Zend\ZendServer\gui\module\Application\Module.php:166
Stack trace:
#0 C:\Program Files (x86)\Zend\ZendServer\gui\module\Application\src\Application\Db\AbstractFactoryConnector.php(36): Application\Module::config('zend')
#1 C:\Program Files (x86)\Zend\ZendServer\gui\module\Application\src\Application\Db\AbstractFactoryConnector.php(30): Application\Db\AbstractFactoryConnector->init()
#2 C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\Factory\InvokableFactory.php(30): Application\Db\AbstractFactoryConnector->__construct()
#3 C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(769): Zend\ServiceManager\Factory\InvokableFactory->__invoke(Object(Zend\ServiceManager\ServiceManager), 'Application\\Db\\...', NULL)
#4 C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(205): Zend\Servi in C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\ServiceManager.php on line 776
The weird part is that I have had a project up and running on a Zend Server already that's been around and working for over a year now, which I've obviously accessed the web-interface for before. I can still run that project locally just fine so I know the server is running but I cannot access the web interface (at http://localhost:10081/ZendServer/) to setup an additional project! Does anyone know what this error is about and how to fix it?
Ok so the answer turned out to be one of my Zend config files was corrupted. That file was the ZendGlobalDirectives file, replacing it with a co-workers copy fixed the issue for me.
Hope this points anyone else having this problem in the right direction

Where to save AWS Credentials file when using shared hosting?

I'm using Amazon's AWS PHP SDK and I installed composer on the following directory 'public_html/composer'. I am currently using shared hosting. However, I have access to the root.
When I tried using AWS's sample code I'm getting the following errors in my error_log:
Fatal error: Uncaught Aws\Exception\CredentialsException: Cannot read credentials from /.aws/credentials in /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php:691 Stack trace: #0 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php(424): Aws\Credentials\CredentialProvider::reject('Cannot read cre...') #1 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Middleware.php(121): Aws\Credentials\CredentialProvider::Aws\Credentials\{closure}() #2 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/RetryMiddleware.php(266): Aws\Middleware::Aws\{closure}(Object(Aws\Command), Object(GuzzleHttp\Psr7\Request)) #3 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Middleware.php(206): Aws\RetryMiddleware->__invoke(Object(Aws\Command), Object(GuzzleHttp\Psr7\Request)) #4 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/StreamRequestPayloadMiddleware.php(83): Aws\Middleware::Aws\{closure}(Ob in /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php on line 691
I created my credentials files as per AWS tutorial:
[default]
aws_access_key_id = 123456789
aws_secret_access_key = abcdefghijklm
The documentation states that I must save it in this location: ~/.aws/credentials
I tried many times to create the directory .aws/credentials however I get the same error. I tried also looking for the .aws file but I couldn't locate it except the one that I just created.
Given the above where should I place the credentials file? TIA
I also had the same issue of cannot read /.aws/credentials
Mentioning my solution here for reference:
This solution is tested in aws-php-sdk version 3.173:
CredentialProvider.php uses getenv('HOME')/.aws/credentials path to load the credentials from the file.
In my case (linux shared hosting) it was empty.
So I set it to desired value using:
putenv("HOME=/absolute/path/to/folder/containing/.aws/folder")

Unable to read the "../.dev.env" environment file in Dotenv.php:symfony

I want To run a symfony project in my computer but I get all times errors , and now I get this error and i didn't find any solution for my problem
Problem Failed to parse output as xml: Error on line 2: Content is not
allowed in prolog.. Command C:\xampp\php\php.exe
C:\xampp\htdocs\buzzaka\bin\console list --format=xml Output
Fatal error: Uncaught
Symfony\Component\Dotenv\Exception\PathException: Unable to read the
"C:\xampp\htdocs\buzzaka\bin/../.dev.env" environment file. in
C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php:466 Stack
trace:
0 C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php(51): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
1 C:\xampp\htdocs\buzzaka\bin\console(38): Symfony\Component\Dotenv\Dotenv->load('C:\xampp\htdocs...')
2 {main} thrown in C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php on line 466
If u move your file from the folder where it was created symfony will keep looking for it on this folder, i've went on autoload_runtime and changed on $runtime variable where the project is, just worked for me, lets see on the last composer dump what just happens haha
The error is quite explicit, do you have a file C:\xampp\htdocs\buzzaka\bin/../.dev.env ?
Well, you need to create one. As announced a little while ago, Symfony will now require a .env file per environment. As you are running your command in the dev environment, you need to create a .dev.env file.

Adding .env file to UserFrosting

I am facing a problem linking my MySQL database to Userfrosting. The guide gives an example of adding a .enr file to the directory so that Userfrosting can read the database credentials, but it doesn't seem to work.
Can someone give me an in-depth tutorial on how to do it?
Here is the error code when running install.php:
Could not connect to the database '#/'. Please check your database
configuration and/or google the exception shown below:
Exception: SQLSTATE[HY000] [2002] No such file or directory
Trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/myUserFrostingProject/migrations/install.php(63): PDO->__construct('mysql:host=;dbn...', NULL, NULL)
#1 {main}
For MAMP, the DB_HOST needs to be set to 127.0.0.1 instead of localhost. It's probably the same case with XAMPP. There's already an open pull request regarding this. See https://github.com/userfrosting/UserFrosting/pull/659.

Categories