post and get conflict (.htaccess) - php

I'm currently experiencing an interessting Problem. I made my own way of auto deploying Websites from GitHub, but I ran into one issue. GitHub sends the payload over the webhook obviously as a POST Request. I have an .htaccess which encodes the url for me. So that it gets transformed to a GET Request, doesn't it? This is the line in my .htaccess:
RewriteRule v1/(.*)$ index.php?request=$1 [QSA,NC,L]
And I need the variables from there... I continue in PHP by making an array out of the GET Parameters with:
$url = explode("/", $_GET['request']);
In the processing I also make some GET requests to GitHubs API.
Now onto the the think that I don't understand. If I run the Webhook, my files don't get uploaded. If I open the site myself, everything gets updated as it should.
Maybe someone has an Idea of the cause and how to fix it?

I just solved my own problem. After waiting for good ~5 Minutes, I executed the Webhook again and the changes were on the Webspace. So probably the GitHub API is at the moment just slow, or it doesn't updates that often.

Related

PHP script redirecting to install.php

DESCRIPTION: I have a normal HTML website (say, https://example.com) and it has been hosted on Hostinger. Last week, I purchased a PHP script from CodeCanyon. I had put this application on this URL https://example.com/VideoDownloader. The website is running perfectly, but, I'm facing problem with this PHP script.
For the first time, if you visit this URL, it'll redirect you to install.php page. Once you install the script (which takes less than 2 mins), you can immediately start using the application by visiting the same URL. Now, it'll not redirect you to install.php.
PROBLEM: The script works perfectly for 1-2 days. The problem is after 2 days, the application breaks and it starts redirecting you to install.php page again. And, again you have to install it to make it work. This cycle keeps on repeating.
There is nothing wrong with the code and it is running perfectly in my localhost. The version of PHP in localhost is the same as that on my Hostinger server.
WHAT I HAVE TRIED: I tested the script in my localhost and it is running perfectly without breaking. Searching on the internet was not much helpful. However, I got the hint that the issue may be related to the MySQL database to upper/lower case characters.
Please, guide me on this.
Website file structure:
Without errors or other information do not think many will / can help you. I suggest checking your error / access logs first.

Website is very slow, but if I modify the URL it loads normally

Not all the time, but sometimes if I visit the site as this http://WEBSITESAMPLE.com/paramA/pathB/, it becomes very slow and nothing loads till a minute or so, but if I add something dummy on the path, it loads immediately, do any of you have an idea why is it?
I am not sure what's going on here because your question lacks a little detail.
But just to make the scenario clear when it comes to Client/ Server side and accessing something on the web with a domain. You have to understand that whatever lags you experience it always points to a certain process that a line of code cannot finish the job in the desired time.
Lags sometimes caused by a script like Javascript(JS) that probably will send request from the server which server can't response in a certain time required by the script.
Also sometimes, browsing to a specified URL without a clear path to a server could cause waiting time.
anyhow, you have to inspect the path you are accessing and the source code and possible process jobs. From there I'm sure you can figure it out.
Otherwise you have to share your setup. Assuming you're the one who setup and build the site.

Laravel App 400 Bad Request

I am developing laravel website and I encounter this very stressfull error.
Yesterday, my website is running smoothly until today. Today, after several times of form submit, It returns:
Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.
I noticed that there are lots of cookies generated from localhost (see image below):
if I delete one of those cookie, I can open my website
I have done several checks on javacript and all other code but couldn't find anything wrong.
What could possibly go wrong? is it on my code? or my web server? or anything?
It turns out that I accidentaly calls 'web' middleware twice.
Just delete one of them and its finally works perfectly.

Why does my php script not "notice" post requests?

I have been running a web service off of a php file. For no apparent reason (possibly some settings changes?), it now suddenly does not "notice" the posted request.
When I echo var_dump($_POST), I get a 0-length array. If I post the same request the same way on a different script, it works fine. This different script is hosted on a different server.
Do you guys have any idea what configuration may have been accidentally changed s.t. my php script does not get the post requests?
Thanks!
I'd start with the rewrites. Rewriting for example to a full url (http://...) would cause POST information to get lost.

Out of date file being requested from a PHP script that no longer references it?

I'm running a LAMP stack on Amazon EC2 for an AJAX focussed application written in PHP with APC caching. I'm sorry if this is the wrong forum but I don't really know if the problem is my server or my code.
One particular ajax call (which always has unique parameters) in my app returns some html with an iframe in it with myphpfile.php as the src (to force evaluation of myphpfile.php - there are better ways to do it sure, but I couldn't find them years ago when I wrote the code!). Yesterday I changed the src variable to myhtmlfile.html and yet there are still clients out there requesting the old myphpfile.php despite there being no reference to it anywhere on my server.
I have cleared the APC cache (by doing an apache2 restart). The vast majority of users are going to the new file, but still 1 or 2 per minute or so are going to the old file (that's not much % of my traffic, but I like to take care of my traffic!). The ones still using the old file tend to be iphone users.
I just have no idea where it could be getting any reference to the old myphpfile.php - it isn't in the php file, not in the apc cache. What else do I have to clear?
Yesterday I changed the src variable to myhtmlfile.html and yet there
are still clients out there requesting the old myphpfile.php
I have requests for files that have been gone for years. Sometimes there's just no stopping them.
but I like to take care of my traffic!). The ones still using the old
file tend to be iphone users.
If you haven't done so already, you can have Apache send the html file to users so you don't have to worry about them receiving 404's. Simply use .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^myphpfile\.php myhtmlfile.html [L]
</IfModule>

Categories