I have a webportal (laravel code base) running on a Cloudlinux based server with PHP 7.2.
Due to some capacity problems we need to love to another server, also Cloudlinux, but PHP 7.3.
I try now to use the new server, but that give me a problem. For some of the parts I need to call a secondary platform (same server). I use for this a GET curl.
On the old server this works perfect, on the new one however I have issues. The data that I pass in the body isn’t read by the new server. When I do a dump of all request data it is not included.
If I run the same system over POST, then somehow it is working perfect.
I know that I can change all requests to POST, but that is a big job, and why does it work then on the old server. I have the impression reading the PHP://input doesn’t work on GET, but don’t know if this is a setting or not.
Switching to another PHP version didn’t help btw
Related
First and foremost: please not that this post isn't about Ajax/PHP status updating. It's pure PHP, my script needs to be able to run in console. Be gentle with that dup' question. Thank you.
I have a web application that starts multiple long running operations on multiple remote servers. The output is in the same format for all those scripts. My master script needs to retrieve the status of all those scripts and then process them and output the result.
So far, I've tried:
Start the remote process then poll results from a check_status.php, who shares the status array via transparent session variables. I found it to be too error/failure prone, and couldn't have a really solid implementation of it.
Stream the output of the server, and find each time the last status JSON string and use it. But this also felt, well, clumsy.
I'm sure I'm missing something. So I'm asking for your help.
My solution requires:
No additional packages to be installed. (e.g PEAR, PECL....)
Works on PHP 5.3.
Preferably, (but not necessary to post a solution, I'd be just grateful) using rmccue/Requests.
This is a very similar to the question posed at Use php and simPro API to list customers.
The response to that question suggests downloading examples from GitHub. I have downloaded the SimPro examples at GitHub and have them functioning on the commandline.
I want to be able to use a web page as an intermediary between my FileMaker Pro database and the SimPro API. I can pass data to a web page written in PHP. It can convert the data to JSON and form a call to SimPro receive a response and display the success or failure as a web page.
Presently I have my JSON data hardcoded so that I can test the process. When run from a web browser I don't get a result, though the code works perfectly well running from the command line.
I'm not sure what I need to do make the examples web compatible. Can someone push me in the right direction?
Would be more than happy to help - could you post a snippet of your code - minus the auth info of course - so that I can try to assist?
Do you have your code printing anything else to the browser first - so that you make sure the script is actually executing as it should from the web server side - and have you checked your web server logs for any errors?
In some cases I've seen this is usually due to PHP config (there are separate configs for CLI and CGI in most setups) and can mean whilst libraries are loaded in one environment they may not be available to the other. The web server also usually requires a reload if you have just loaded libraries for use within your script.
Hope that helps.
This is a continuation of a tumbleweed question:
Getting Forbidden error when saving pages with PHP
The host my client uses seems to use something to check/block potentially malicious scripts from being saved to the server. When I try to save a file that uses any PHP, it comes back Forbidden.
Mostly it's just include(), and usually just one or two.
Anyone know of a way to safely keep my PHP intact when updating files via POST/PHP?
(I don't really need it to be able to add additional PHP, just keep what's in it.)
P.S. :: It works locally, just not on their host server.
I've been looking for days and haven't found a solution yet :/
This is a strange problem but it happens enough that I wanted to ask.
For some reason, sometimes the browser will force a php page to download to the browser and it always comes up with 0 bytes.
Mind you, I'm not trying to force the download and I'm very familiar with headers and forcing files to download intentionally, what I'm talking about is an issue where the browser can't process the page and thus it spits it out as a forced download.
One Example: I've got phpMyAdmin 2.3.2 running on a PHP4 server and a PHP5 cloud server. On the PHP5 cloud server, if I click "browse" on a table it tries to spit out sql.php as a download and it comes out empty.
I know the details are vague and I don't expect a solution as much as some ideas in where to look or possibly if someone else has experienced the same thing.
BIZARRE UPDATE:
When the URL has the word "Select" in all caps it breaks.
Works:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=Select
Breaks:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=SELECT
Noodle that one!
ANSWER:
As it turns out, the words SELECT, UPDATE and INSERT (yes, all caps) are blocked words on The RackSpace cloud. You cannot pass these via a GET request, only POST.
However, if you change them to Select, Update and Insert they work just fine. Seems they are not blocking everything.
I have seen that when I'm trying to access a server to which I don't have a valid network route. For example, I set a tunnel proxy in Firefox, through ssh. Then try to connect to localhost - I get a download of a 0 byte PHP file.
The download is happening because it has an extension of PHP, with no content, and the server is not sending you a MIME type, so the browser doesn't know how to handle it, and reverts to a download.
Sounds like a server misconfiguration.
PS. stop using PHP 4.
In my experience this sometimes comes with a segmentation fault of the webserver, due to php scripts behaving badly (the foo(){foo();} kind of crash)
segmentations faults are logged in the apache error log.
Let me start by saying PHP isn't my forte, I'm usually reluctant to try working with it because of problems exactly like this. The code works fine on my local machine under MAMP and on my server, but doesn't on the clients server :'(
So what am I trying to do, well - save an image from Flash onto the server, simple right?!
I'm using the method described on this site here: http://designreviver.com/tutorials/actionscript-3-jpeg-encoder-revealed-saving-images-from-flash/ but have made a small alteration so that instead of echoing the jpg causing the browser to download it locally, I do an fwrite and an fclose to save it to the server.
Here is my PHP:
I've dona a phpinfo() on my clients server and it's running 5.2.2 my host is running 5.2.11 I don't know if much can have changed in those 9 minor revisions?
I've also read another question on here which suggests making suer always_populate_raw_post_data is set to ON, but it's set to OFF on all of the server environments I've been testing in. I'm doing some XML saving using file_get_contents('php://input') which I've tried but failed to get working with images.
Any help would be gratefully received, I'm happy to post the AS3 as well but it's EXACTLY the same as example I've linked above and works locally. As far as I can tell the problem lies with the PHP.
Cheers.
Is there any reason you're using the HTTP_RAW_POST_DATA? If Flash is sending the file via the POST method, it'd be by far easier to use the $_FILES array. There'd be no need to fopen/fwrite, as the file's already been stuck into a temp dir by PHP. All you have to do is use [move_uploaded_file()][1] to put it wherever you want on the server.