In the Heroku PHP documentation they talk about "accessing /db" but I am not sure how to do this. Here is the page I am referring to:
https://devcenter.heroku.com/articles/getting-started-with-php#provision-a-database
It's the part that starts "Now when you access your app’s /db route..."
As a total newbie to PHP and heroku, I had this same question. After some playing around I found that "when you access your app’s /db route" means to do the same thing as you did for the cowsay dependency earlier in the tutorial but replace 'cowsay' with 'db', so
instead of:
$ heroku open cowsay
write
$ heroku open db
/db will be exposed as a web page and will return the contents defined by the query and the template. This way you can easily provide read access (GET http method) for a table's content.
Related
I’m new to Shopify App development. I’ve developed an app using a php template provided by shopify. It’s using Laravel & React. It’s https://github.com/Shopify/shopify-app-template-php/tree/cli_three
When I execute npm run dev, the app is running in the development store.
Then, I deployed my app on the AWS server using one domain (e.g: sub.mydomain.com).
Before deployment:
I have build the frontend using: SHOPIFY_API_KEY=MY_API_KEY npm run build
I’ve run composer build too.
After that, I tried to install the app. While doing so, It’s authenticating and saving the session in the database too.
But, on redirecting after authentication, it’s not working,
First, It’s giving this error on console:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://mystore.myshopify.com') does not match the recipient window's origin ('https://sub.mydomain.net').
And then after redirect, it’s displaying:
Along with console error:
GET https://mystore.myshopify.com/admin/apps/40aac89c4c56232219d0f1f75a1f2ae7/?hmac=68236dae6688aafd05925cf409dfff0965236542401999f8ff47decd8b942d&host=cW9kZWFuYWx5dGljcy5JKihgZnkuY29tL2FkbWlu&shop=mystore.myshopify.com×tamp=1657698129 404
About that console error you need to add this header on top of the page in views top_level.blade.php
<?php
$domain= $shop ?? Auth::user()->name ; ; // loged-in shopify store url example.myshopify.com
header("Content-Security-Policy: frame-ancestors https://".$domain." "."https://admin.shopify.com");
?>
This will resolve the does not match the recipient window's origin error.
After that try to open the app again or you can remove the entry from db and install the app again hope that will help.
I'm following the official docs to setup google cloud firestore to integrate with my php project
[1] https://cloud.google.com/firestore/docs/quickstart-servers
when I initialize the FirestoreClient I get the following error
Error rendering 'projects/{project=*}/databases/{database=*}': expected binding 'project' to match segment '{project=*}', instead got null\n
Provided bindings: Array\n
(\n
[project] => \n
[database] => (default)\n
)\n
First In the documentation it tells to use ENV VARIABLE though using the following command
export GOOGLE_APPLICATION_CREDENTIALS=/Users/user/Desktop/programming/workarea/.firebase.config.json
I investigated a lot and I think the problem happens when the library tries to establish a connection with the firestore server.
I couldn't find the root of the problem. but I think for some reason the php server not reading the env vars so it's not able to establish a proper connection
I struggled some time with this too, resolved it after realizing this: as said here, you first have to authenticate. For that, install the gcloud-sdk available here, then follow the steps provided.
Second, you have to set your environment variable with the path to your project's credentials file, as you were doing, in the bash (i use ~/.bashrc), exit the terminal and reenter it (necessary, as it may not apply the file edit for that terminal session). You could also type source .bashrc to apply changes without closing the terminal.
Then you should be fine, assuming you have the other required environment dependencies installed found here.
When trying to login with a Facebook app, I'm getting the following error:
Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.
As you can see on the following image:
URL: http://www.facebook-php-test.com
Below is the configuration I have set on my Facebook App.
(Notice: for privacy purposes I changed the values for App ID and App Secret on the image)
The code for this basic sample application is on this GitHub repository:
https://github.com/zeuscronos/facebook-php-test.com
I really don't know why it says that the domain of this URL isn't included in the app's domains when it is actually there.
On the field: App Domains I tried with both domains at the same time:
facebook-php-test.com
www.facebook-php-test.com
but no success.
The generated login URL is as follows:
https://www.facebook.com/v2.10/dialog/oauth?client_id=012345678901234&state=d3758e484d539bebd6505427aaf1fa3b&response_type=code&sdk=php-sdk-5.6.1&redirect_uri=http%3A%2F%2Fwww.facebook-php-test.com%2Ffb-callback.php&scope=email%2Cuser_friends%2Cuser_photos
I configured the domain: facebook-php-test.com as a virtual host on an Apache server.
I have to say that I have worked a lot with the Facebook PHP SDK and this is the first time I'm getting struggle with this. Actually, I got this problem with another big application I was working with then after couple of hours trying to solve the problem I created this dummy application to try to figure out what's the cause of the problem.
I have tried many things with no success.
Any idea on how to solve this?
Thanks.
EDIT 01
Following the suggestion of Mr.Geeker comment I did the following...
Added the product: Facebook Login and configured like below:
Then, finally I could go forward, and I was asked for permissions:
But unfortunately, after granting permissions, I got the following:
Any idea on how to continue from this point?
EDIT 02 - SOLUTION
I ended disabling the option: Use Strict Mode for Redirect URIs under Client OAuth Settings. They say it is strongly recommended has this feature On but I could not get this working with that On.
By the way I also disabled: Client OAuth Login since my app doesn't use it.
Finally, the only feature I have enable under: Client OAuth Settings is: Web OAuth Login.
Facebook now roles some features as plugins. In the left hand side select Products and add product. Then select Facbook Login. Pretty straight forward from there, you'll see all the Oauth options show up.
As originally answered here
On March 2018, facebook updated the API and forced all apps to keep strict mode On.
To make it work, you have to include the full callback url in the Valid OAuth Redirect URIs field. If you redirect to "https://www.example.com/facebook/callback", the full URI must be included (without parameters):
The domain must be set in the App domains and the Website Site URL fields on the basic settings page:
If none of these works and the "Can't Load URL: The domain of this URL isn't included in the app's domains." message keeps showing, check if you have the latest version of the SDK. I could make it work after updating de PHP SDK from version 5.5 to 5.6.2
I'm using PHP 5.5 and I found the bug.
The PHP Facebook API VERSION = '5.5.0', DEFAULT_GRAPH_VERSION = 'v2.9' was adding the URI ?code=XXX in my callback page like this:
mydomainExample.com/callbackFacebook.php ?code=XXXXXXX
and I changed the source code to remove the string after '?'. Now the callback url is only
mydomainExample.com/callbackFacebook.php
The fixed can be done in the file Facebook/Helpers/ FacebookRedirectLoginHelper.php inside the getAccessToken function. I added a 'if' as below in the line 226 and the issue gone:
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
//the next 3 lines was added to avoid the bug (fixed)
if(strripos($redirectUrl, "?")){
$redirectUrl = substr($redirectUrl, 0, strripos($redirectUrl, "?"));
}
// At minimum we need to remove the state param
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']);
We have Redmine & Testlink hosted on 2 different servers on Amazon Cloud.
I used below methods / workarounds to establish a connection between these two, however I am getting "Something is preventing to connect to bug tracking system, it will create performance issue..." on Execute Test page of testlink.
Made below configuration in Issue Tracker Management under
Redmine(interface:rest)
<issuetracker>
<apikey>3fe68920f3cf</apikey>
<uribase>https://odessa.sharred.net</uribase>
<uriview>https://odessa.sharred.net/redmine/CM/issues/</uriview> <!-- for Redmine 1.x add show/ -->
<projectidentifier>Common</projectidentifier>
</issuetracker>
Enabled API from redmine.
Made settings in C:\xampp\htdocs\testlink\third_party\redmine-php-api\lib\redmine-rest-api.php for curl_setopt() to allow to use HTTPS.
Tried giving Redmine Base URL using IP ADDRESS instead of Host name.
Do not see any relevant logs in testlink's events section.
Added entry of redmine in config.inc.php with $g_interface_bugs='REDMINE';
Also observed that URL given in URIBASE is opening in web browser with parameter passed as key i.e. https://odessa.sharred.net?key=3fe68920f3cf
is accessible from testlink server.
Any insight / solution on this issue will be great help.
Your configuration should look something like this.
<issuetracker>
<apikey>3fe68920f3cf</apikey>
<uribase>https://ServerIP/redmine</uribase>
<uriview>https://ServerIP/redmine/issues/</uriview>
<projectidentifier>CM</projectidentifier>
</issuetracker>
I also had trouble and just got it working now.
If you still have issue goto http://TLServerIP/testlink/lib/events/eventviewer.php and check the error
Similarly you can go to //redmineinstalldir/apps/redmine/htdocs/log/production.log to see what error you are getting after you click test connection on testlink
Why does my login script only work when i am at the URL: "http://localhost:80/".
Why does it not work when i am at the URL: "http://localhost/index.php".
I am using MAMP with php 5.2 on it. The Ports are set to 80 and 5506.
1. When i login from index.php it gives me a resource id 5.
2. Why does this happen and how should i fix it?
Please can you explain it in easy terms?
Thank You
You have made an error inside your login script with the data you are returning. PHP has a resource variable type it uses for database connections and file handles. In your code you are apparently doing an "echo $var", and $var is a resource variable. This is why you are seeing "resource id 5".
You should probably make a new php/mysql question, that includes the source where this is occurring, if you need further help.
Are you accessing you file through MAMP Localhost then appending index.php. Try removing the http:// when you go through your server/Localhost it doesn't include the http://..