I'm beginner trying Mongodb.
I installed Mongodb and localhost:28017/ is working.
When I start service via terminal "/etc/init.d/mongodb start" it works.
But I added test.php file in /var/www/
<?php
$connection = new Mongo();
?>
but I'm getting server error "Server error
The website encountered an error while retrieving localhost/test.php. It may be down for maintenance or configured incorrectly.".
There's two parts to MongoDB: the server part, and the client part. The server part does all the real work, but you need to be able to talk to it. Client libraries fill that gap. They abstract the underlying network communication and present a nice API (e.g., new Mongo()) to the user. You've got the server running; that's great. You have not, however, installed the client library for PHP, so PHP has no idea what to do with new Mongo().
Related
Currently, I developing a WordPress plugin with React frontend.
I tried to connect my backend (PHP) running on a virtual host with webpack devserver with hot module replacement (HMR).
Is there any config how to do it.
note: I tried with devserver proxy but cant figure it out.
Thanks in advance.
Getting HMR is always complicated for custom setup like these. Theoretically, this is pretty simple. You simply need to run the webpack-dev-server with the HMR module. On your PHP file, make sure it uses the JS file generated from webpack-dev-server. The code to refresh is bundled in the JS file so it should work.
However, the devil is in the details. You'll need to make sure the communication between your page and webpack-dev-server works without issue. Monitor your websocket network request and make sure they communicate as expected.
An issue you'll probably encounter is security since the websocket connection is expecting a different host. In this case, you can use config from the following answer: I am getting an "Invalid Host header" message when connecting to webpack-dev-server remotely
Another issue could be that the JS file tries to connect to the wrong location. Eg: It thinks that your host is where the websocket connection is. If this is the case, you can use the public setting. See here for documentation: https://webpack.js.org/configuration/dev-server/#devserverpublic
To me this is akin to running with a reverse proxy. You can see this discussion to understand the problem: https://github.com/webpack/webpack-dev-server/issues/804
There might be other problems. You just need to check the websocket connection and make sure they communicate without problems
How you refer to the generated js file is a separate problem. A simple example would be setting the port to 8081 and bundling the js file into bundle.js. Then in your php code, refer to it as http://localhost:8081/bundle.js
I have an application (php/node.js/mysql) running on a fully configured EC2 instance, using elastic beanstalk connected to an RDS DB. I tried to recreate that instance and run a test application and it didn't work, I though it might be something with the config of the instance, so I cloned the instance that is running correctly and tried to run the test app (which is exactly like the prod app) and I get this error: DNS_PROBE_FINISHED_NXDOMAIN
It has nothing to do with my internet connection, which is working fine. A couple of facts:
1- when I run the app on the instance I created, it does load the index.html page, but does not connect to any other page (this is a php/node.js/mysql app), and I get error 404.
2- when I try to load the url in the second (cloned) case, the subdomain I created, receives a www from the browser and gives me the error above. This could be some kind of wrong config on my godaddy, but it gives me no error when I try it on the created instance.
I'm having a hard time trying to figure this out, can someone shed some light pls?
Thanks all!
At first, sorry for my English.
I'm currently installing the newest version of simplesamlphp (an unknown tool 'till now for me + I'm a Java developer (not php) so my knowledge on php is limited).
The main aim is to use CAS with SAML2 using simplesamlphp.
The problem is... on CAS.php module file we have a call to 'new SimpleSAML_Auth_LDAP(...)' which is supposed to create a connection to the ldap server, but it fails and shows no error (just a blank page). I tracked the error to the ../lib/SimpleSAML/Auth/LDAP.php file constructor; it fails when it tries to connect to the ldap:
$this->ldap = #ldap_connect($hostname, $port);
Any idea about it?
I finally managed to make it run, i just had to reinstall php5-ldap, seems that something went wrong the first time it was installed. Now I have more doubts about how it really works, but the post is resolved.
Need basic help configuring Google App Engine SDK on a Windows 7 system to use a local install of MySQL. The GAE install is vanilla (GAE 1.8.8, Python 2.7.6, PHP 5.4), with MySQL 5.6.15 also installed. I am able to use the MySQL console, so MySQL is running. PHP is also running.
When I run a short PHP script consisting almost entirely of this line:
$dbconn = mysql_connect('localhost','root','rootpwd');
this is the error message I get:
Warning: mysql_connect(): No connection could be made because the target machine actively refused it.
My question: What settings do I need to add or change to allow my PHP scripts to connect to MySQL?
My root username and password are correct, as verified by my ability to access MySQL through the console. There are some difference between the GAE SDK setup and that of a WAMP server, which I also have installed on the same machine but which is not running now. Is there still likely to be a conflict between the freshly installed MySQL instance and the one on the WAMP server? Are there some environment variables (in Windows, in the SDK, or elsewhere) that I need to set?
I'm fairly sure this question has been asked before, but the answers I am seeing are either more complex than I can believe would be necessary, or simply gloss over the details of configuring the connection. Any help would be appreciated.
FIGURED IT OUT... Apparently my script was being pointed to the MySQL instance from the WAMP server, which was not running when I tried to connect in the script. As soon as I started that MySQL instance, the script connected to it.
So the moral of the story is... if you already have a MySQL instance installed outside of the GAE SDK, as long as that service is running your GAE PHP script will find it, and there's no need to install another MySQL instance just for the Google SDK.
You must allow external connection.
I don't know the path, but, apparently, the GAE connects to localhost not directly.
You can change the "localhost" by "127.0.0.1" to test it, or to "::1".
Some links to try change MySql external connections rules.
http://www.thegeekstuff.com/2010/08/allow-mysql-client-connection/
How to allow remote connection to mysql
I am using the Heroku app to host a facebook application since Facebook is changing how they have their applications set up, again. However I need to connect to the MySQL Externally from my cPanel VPS and I am not able to connect correctly. I have tried using the darkprospect.net(host domain), ultimate-battle-online.com (primary domain of user) and 184.154.20.170 as well as those plus the combination of added port 3306 and none have worked. I previously needed to make sure that I added the right domain to the right file but right now it's just not connecting. Right now get this error when using mysql_connect() function:
Lost connection to MySQL server at 'reading initial communication packet', system error: 110
Again, thank you for any ideas that you may have!
EDIT: I found out that it was an issue with the buildpack that is the default for PHP apps, since I develop on a VPS with PHP 5.4.7 I was using parameters that were tuned for it and were not very supportive on their bundle of vanilla PHP and Apache.
I was able to create a new Heroku buildpack that was able to support all of the features that my application was needing. Because I was developing on my VPS in PHP 5.4.7 my configurations were designed for more of the new features and with the Heroku's basic Buildpack only having PHP 5.3.10 there were unseen errors in background logs that were halting the connection process. Additionally CSF Firewall was configured only for UDP income 3306 and I was able to add it to UTP as well and that seemed to resolve the Connection Timed Out error that was the final error after I made a better buildpack for myself.