Php-generated images intermittently showing after moving to HTTPS - php

I've switched my website to use https, rather than http, and everything is fine apart from images that are generated as a result of Php code executing (static images are ok). As an example, my phpBB forum is one area where this is happening, where images are sporadically not showing (some are, some aren't, with no common pattern). Even simple Php scripts that generate images are showing this strange behavior. If I go back to HTTP then everything is fine.
The error_log contains the following (just one example of an image failing to render), It's almost as if the file generating the image does not complete its execution.
[Mon Dec 30 12:12:01.347282 2019] [core:error]
[pid 247428:tid 23291082008320] [client 90.248.211.216:0] End of script output before headers: file.php, referer: https://www.ukbutterflies.co.uk/phpBB/viewtopic.php?f=37&t=9757
[Mon Dec 30 12:12:01.347709 2019] [:error]
[pid 235457:tid 23291117729536] [client 90.248.211.216:0] SoftException in Application.cpp:630: Could not execute script "/home4/ukbutte1/public_html/phpBB/download/file.php", referer: https://www.ukbutterflies.co.uk/phpBB/viewtopic.php?f=37&t=9757
[Mon Dec 30 12:12:01.348063 2019] [:error]
[pid 235457:tid 23291117729536] [client 90.248.211.216:0] Caused by SystemException in API_Linux.cpp:458: execve() for program "/opt/cpanel/ea-php71/root/usr/bin/php-cgi" failed: Resource temporarily unavailable, referer: https://www.ukbutterflies.co.uk/phpBB/viewtopic.php?f=37&t=9757
The site .htaccess file includes the following, in case this is relevant (this is intended to direct every access request to a secure URL):
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

Related

URLs not correctly rewritten - mod proxy error

I am running the official docker php image: php:7.4-apache
Some URLs are not correctly being rewritten. We are seeing IPs in some links in the docker container but not when we test locally in MAMP.
These are the types of rewrites we are doing in the htaccess file :
RewriteRule ^gift-cards/(.*)$ http://34.245.51.253/gift-cards/$1 [P]
### Redirect for merchants pages
RewriteRule ^merchants/(.*)$ http://34.245.51.253/merchants/$1 [P]
The logs are showing:
[Mon Nov 14 12:00:14.313116 2022] [proxy:debug] [pid 26] mod_proxy.c(1503): [client 172.17.0.1:56704] AH01143: Running scheme http handler (attempt 0)
[Mon Nov 14 12:00:14.316758 2022] [proxy_ajp:debug] [pid 26] mod_proxy_ajp.c(769): [client 172.17.0.1:56704] AH00894: declining URL http://34.245.51.253/
I can see a similar question here AH00894: declining URL fcgi
But the container isn't running PHP FPM so I am not sure how to proceed?

500 Server Error after moving media wiki directory

I had a media wiki installation on the main directory /public_html/ of my domain and had short URLs enabled to http://example.org/wiki/Page_title so I had an .htaccess file with the following rules
# Enable the rewrite engine
RewriteEngine On
# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]
I want to install other applications in the main directory of that domain so I am trying to move this media wiki installation from the root /public_html/ directory to the /public_html/w/ while keeping the same short url format. So all I did was copy the content from the main directory to the /public_html/w/ directory and modify the .htaccess rules to
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
# Enable the rewrite engine
RewriteEngine On
# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
And also modify the LocalSettings.php file in the new directory from
$wgScriptPath = "";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
to
$wgScriptPath = "/w";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
In theory, since it's using the same db and all the same settings all I needed to change was the htaccess and localsettings.php directories and it should work fine but after I tried it I got a 500 server error and the site was not working at all and after I checked apache/php error logs I found a lot of the same stuff
[Sun Feb 28 13:59:14.477785 2016] [:error] [pid 12164] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:21.854117 2016] [:error] [pid 12165] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:32.073190 2016] [:error] [pid 12374] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:33.574025 2016] [:error] [pid 12166] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:35.873162 2016] [:error] [pid 12167] [client SERVER IP] PHP Warning: require_once(/home/admin/web/MY DOMAIN/public_html/w/extensions/MsUpload/msupload.php): failed to open stream: No such file or directory in /home/admin/web/MY DOMAIN/public_html/w/LocalSettings.php on line 301
[Sun Feb 28 13:59:35.873207 2016] [:error] [pid 12167] [client SERVER IP] PHP Fatal error: require_once(): Failed opening required '/home/admin/web/MY DOMAIN/public_html/w/extensions/MsUpload/msupload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/admin/web/MY DOMAIN/public_html/w/LocalSettings.php on line 301
Notice the first errors are still referring to the previous root /public_html/ directory while the extensions errors are already referring to the /public_html/w/ directory
I have no clue where I went wrong here so I would appreciate some help. So far I had to revert the changes and restore a backup I had for the old directory but I still want to move the wiki directory.
If you are still keeping /home/admin/web/MY DOMAIN/public_html/ as the root directory (as identified from the webserver) but, moving Mediawiki down a level, you might need to change the following:
RewriteBase /w/
There is no need to move media wiki from the currently operational location. As you are installing additional applications and media wiki already uses short URL's which makes accessing articles work using the form example.org/wiki/Article_Title what you can do is install the new applications in sub folders right along side the mediawiki installation without any issues at all, as the .htaccess rules will provide exceptions for files and folders which exist on the server.
Example folder structure
public_html /
app1/
index.php
...
app2/
index.php
...
app3/
index.php
...
... (all media wiki files and folders)
I'm not familiar with MediaWiki, but given this comment:
Notice the first errors are still referring to the previous root /public_html/ directory while the extensions errors are already referring to the /public_html/w/ directory
I found the following comment on mediawiki.org:
If you redefine this [$wgScriptPath] in your LocalSettings.php then all dependent variables will need redefining too!
I'd investigate what else is set during installation time using this value, as that may be the cause of your issue.

Error 500 after upgrade to PHP 5.6

everybody
I'm working on certain project and it worked just fine until the server provider decided to upgrade to PHP 5.6 and now the page is showing error 500.
I've already checked and I found out that this can be caused by few things...
This particular project doesn't use .htaccess file so, I know that's not the problem.
I also read that problem can be somewhere on server so checked the log and this is the message that I get.
[Fri Dec 04 10:17:47.603342 2015] [fcgid:warn] [pid 12468] (104)Connection reset by peer: [client 10.32.109.52:55105] mod_fcgid: error reading data from FastCGI server
[Fri Dec 04 10:17:47.603409 2015] [core:error] [pid 12468] [client 10.32.109.52:55105] End of script output before headers: index.php
You've got a message: End of script output before headers: index.php
So check your code in index.php. Just try to delete all code from file index.php and add this:
<?php phpinfo(); ?>
This should outputs information about PHP's configuration. If you can see this, so the problem is in your code in index.php.

500 Server Error on Localhost on Laptop - Works fine on other desktop machines

for a project we have been working on we have moved it onto a laptop so work can be done at home.
The issue we are having is that the server is giving us a 500 server error on the laptop machine, but works perfectly fine on every desktop we have tested it on.
the htaccess. files are all the same, error logs don't bring up anything noticeable (except the 500 error in the console on the login form which is where it first falls over).
We are using the yii framework and even with all error reporting turned off it still refuses to work. All permissions are fine and the the entire project has been downloaded off our git machines.
We are running virtual hosts and sub domains but even accessing straight from the folder there is no luck.
httpd.conf and vhosts are also, exactly the same.
Is there anything that would flag up differences on two machines?
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
the erorr coming from the error log
[Thu Nov 12 12:21:16.002251 2015] [auth_digest:notice] [pid 6961] AH01757: generating secret for digest authentication ...
[Thu Nov 12 12:21:16.024984 2015] [mpm_prefork:notice] [pid 6961] AH00163: Apache/2.4.12 (Unix) OpenSSL/1.0.1m PHP/5.6.8 mod_perl/2.0.8-dev Perl/v5.16.3 configured -- resuming normal operations
[Thu Nov 12 12:21:16.025061 2015] [core:notice] [pid 6961] AH00094: Command line: '/Applications/XAMPP/xamppfiles/bin/httpd -E /Applications/XAMPP/xamppfiles/logs/error_log -D SSL -D PHP'
error in console
POST http://m/site/login 500 (Internal Server Error)send # jquery.js:9631jQuery.extend.ajax # jquery.js:9176$.fn.yiiactiveform.validate # jquery.yiiactiveform.js:357(anonymous function) # jquery.yiiactiveform.js:96
jquery.js:9631 POST http://m/site/login 500 (Internal Server Error)send # jquery.js:9631jQuery.extend.ajax # jquery.js:9176$.fn.yiiactiveform.validate # jquery.yiiactiveform.js:357(anonymous function) # jquery.yiiactiveform.js:145jQuery.event.dispatch # jquery.js:4641elemData.handle # jquery.js:4309

I keep getting the same error in my error logs on my apache server using cpanel

cPanel Version 11.28.87
Theme x3
Apache version 1.3.42
PHP version 5.2.13
MySQL version 5.0.92-community
Architecture i686
Operating system linux
I noticed in the Error Log that I was getting the same error repeatedly. A simple missing .gif that was being requested.
[Tue Apr 12 12:12:23 2011] [error] [client --.---.---.---] File does not exist: /public_html/themes/3col_blue/images/dogcat.gif
So I thought well lets just put that .gif (our logo) there...
Now I am getting a whole slew of errors regarding file does not exist that look like this:
[Tue Apr 12 02:27:47 2011] [error] [client --.---.---.---] File does not exist: /home/--------/public_html/index.php+++++++++++++++++++++++++++++++++Result:+\xe8\xf1\xef\xee\xeb\xfc\xe7\xee\xe2\xe0\xed+\xed\xe8\xea\xed\xe5\xe9\xec+"reltWeiweessy";+\xe7\xe0\xf0\xe5\xe3\xe8\xf1\xf2\xf0\xe8\xf0\xee\xe2\xe0\xeb\xe8\xf1\xfc+(\xe2\xea\xeb\xfe\xf7\xe5\xed+\xf0\xe5\xe6\xe8\xec+\xf2\xee\xeb\xfc\xea\xee+\xf0\xe5\xe3\xe8\xf1\xf2\xf0\xe0\xf6\xe8\xe8);
[Tue Apr 12 02:27:42 2011] [error] [client --.---.---.---] File does not exist: /home/--------/public_html/index.php+++++++++++++++++++++++++++++++++Result:+\xe8\xf1\xef\xee\xeb\xfc\xe7\xee\xe2\xe0\xed+\xed\xe8\xea\xed\xe5\xe9\xec+"reltWeiweessy";+\xe7\xe0\xf0\xe5\xe3\xe8\xf1\xf2\xf0\xe8\xf0\xee\xe2\xe0\xeb\xe8\xf1\xfc+(\xe2\xea\xeb\xfe\xf7\xe5\xed+\xf0\xe5\xe6\xe8\xec+\xf2\xee\xeb\xfc\xea\xee+\xf0\xe5\xe3\xe8\xf1\xf2\xf0\xe0\xf6\xe8\xe8);
how did I make this go from bad to worse?
Are there referers for those particular hits in the access_log? Looks like someone/something is pointing at your site with a badly constructed link.

Categories