Google compute engine php post request gives http 500 error - php

I'm really new in google cloud services and servers. I've successfully installed LAMP over SSH. However, when I try to post, get request over postman or application it always gives me 500 Internal Server Error. I wonder if there is a configuration that I missed? I do not know, maybe it is a problem with the port or maybe I should ho with App Engine instead of Compute Engine. I do not know what kind of document or code I should put here. In cases when you want I can share. Thank you!

I found the solution from log file! thank you #jabbson :) I learn that is very important and helpful to check log files.
phpenmod mysqli
whit this command I've successfully activate extension and now it gives respond code 200. If someone will face this issue first -> check the apache2 log files, then-> don't forget to activate required plugins or extensions!

Related

connect webpack devserver (HMR) with PHP project running with virtual host

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

Ldap connect fails in php

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.

Websockets can't connect to server

I am trying to obtain some education on websockets but I can't really find a decent tutorial. All tutorials out there instruct you to download a server and teach you how to use it. I'm more interested in how the server actually works and how I can control it on a remote host, like a hosting provider.
Anyway if I wanna learn there really aren't many options other than to download a built server and start inspecting. So I downloaded the server given in this tutorial http://dev.tutsplus.com/tutorials/start-using-html5-websockets-today--net-13270
The problem for now is that I can't even seem to connect to it. I'm running XAMPP on Win7, so it's completely relevant to the tutorial and appears quite easy, however I fail. I've managed to start the server, but when I open client.php I get
Firefox can't establish a connection to the server at
ws://localhost:8000/pol/newWS/server/startDaemon.php. var socket =
new WebSocket(host);
Fortunately chrome appears to provide a more detailed error message
WebSocket connection to 'ws://localhost:8000/pol/newWS/server/startDaemon.php' failed: Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing
Javascript's host variable is set to 'ws://localhost:8000/pol/newWS/server/startDaemon.php', that's where the server is located on my localhost. I haven't made any changes to the server. Can anyone help me get this thing going? Thanks in advance!
Websockets in PHP are generally a pain in the ass. Even if you use a library like rachet you need to start it separately, not through a webserver.
As brad said, consider using node.js or the excellent autobahn.ws for python.
I just found some WS server I have downloaded in the past which works pretty well. I can't confirm for any security issues but if anyone knows or finds anything please don't spare us the sharing. I searched for some info in the comments but I couldn't find anything about the creator so I can't really give any credits.
files here

Whitelisted for PHP in GAE

I'm completely new to GAE. I'm aiming to build a webapp on Google Cloud SQL and GAE, using PHP to write to/from the database. I've got it working locally through the GoogleAppEngineLauncher localhost server, both succeeding at HelloWorld and reading from the Google Cloud SQL through PHP. When I upload to GAE, not even the HelloWorld will work.
One guess would be that PHP is not enabled on my GAE. I clicked the opt-in, and it said I've been whitelisted, but how can I verify it is turned on?
Cheers,
Ben
There is no whitelisting anymore, anybody can use the runtime.
Suggest you go to the admin console and look at the logs for your application to try and debug what might be going wrong.

Something Server Specific Not Allowing Connect with Facebook

I had FB connect working perfectly fine on my site. Then one day, we noticed it was no longer working. It is not giving any errors, but when I try to do the getUser() function from my facebook class, the response to the send of my signed request is coming back empty, no user data. That is the basic problem, but let me detail what I have nailed down.
I believe there is a problem with the server somehow, either something inside httpd.conf or perhaps php.ini and here is why.
I took all my PHP pages that are required for the FB integration over to another server and another domain. They worked fine. That, to me, ruled out a problem with the code itself, or the Facebook App settings I am using.
I then went back to the problem server, and setup a 3rd domain and tried the same thing again. It would not work. So that, to me, ruled out a problem with the specific domain I am ultimately trying to get working again.
I will admit, I dont know what changes may have been made between the time it was working and when it suddenly was not. If I did, I had a solid idea, I would just roll it back. I did have someone, "recompile apache with mod_deflate and mod_cache." I tried to search for those causing a problem with FB but didnt find anything.
PHP Version 5.3.10
Server version: Apache/2.2.22 (Unix)
Server built: Feb 10 2012 20:31:21
Cpanel::Easy::Apache v3.9.1 rev9999
Thank you for reading my question.
I have resolved my situation. The key to my solution was going to line 633 of base_facebook.php and going an echo $e; to determine why the token response was failing. I then managed to identify the root of the problem:
CurlException: 1: Protocol https not supported or disabled in libcurlCurl
So I contacted my server support people who informed me, "The curl php module has been built without ssl support." which was after they had said
"I am almost positive that when I rebuild apache I made sure curlssl was checked. This is a typical option that people request to have enabled, so I always make sure it is enabled."
So the end solution was that they had to recompile apache and php with the curlssl module.

Categories