After 450 hours of work my web-app doesn't work anymore, and I don't know how to solve it. Let me explain the situation:
I was inserting my website into the server and playing around with htaccess.
I have changed many times the htaccess playing around with symlinks, rewriting url to go to redirect to https, etc.
My website was logging in the user and now not anymore working for this function anymore:
The Apache log is this one repeating the same name of the folder:
[13/Oct/2017:21:44:59 +0200] "GET
/developement/index.php/fold/fold/fold/fold/fold/fold/loginform.inc.php
HTTP/1.1" 302 9358 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64;
Trident/7.0; rv:11.0) like Gecko"
I have just changed the httpd.conf in Xampp inserting: AllowOverride All
after I discovered it was on none
I don't really know what's going on:
I think I have a problem in my php where I write the header:
header("Location: ../invoice.php"); if the user is logging in.
I have read that you can't have any echo in the php file before header if not is not working
Further info:
I have included a core.php file in all the files so I define some functionlike the below:
<?
ob_start();//to use the header func to redirect to index.php after log in
session_name("test");//to hide session id def cookie name PHPSESSID=
session_start();//to save the global var user id after log in
//Errors On/off
if(strstr($_SERVER['SERVER_NAME'],"localhost")) {
// Make sure we show all errors
ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL);
ini_set('html_errors', 'On');
ini_set('display_startup_errors','On');
} else {
//IMP: DA VERIFICARE SE FUNZIONA NEL SERVER!!!!!!!!!!!!!!!!!!!
// We also want to suppress all warnings
ini_set('display_errors', 0);
error_reporting(0);
ini_set('html_errors', 'Off');
ini_set('display_startup_errors','Off');
}
//this to define links in my HTML (in header(Location: MIO./myfolder ) it does not work !!!)
//define http root
define("MINE",($_SERVER["SERVER_NAME"] == "localhost")? "http://localhost/developement/" : "https://www.mywebsite.it/");
//echo MINE;
?>
Content of .htaccess:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^mywebsite.it [OR]
RewriteCond %{HTTP_HOST} ^www.mywebsite.it [NC]
RewriteRule ^(.*)$ https://www.mywebsite.it/$1 [L,R=301]
Xampp Apache Access Log:
::1 - - [15/Oct/2017:00:47:10 +0200] "POST /developement/elgin/loginform.inc.php HTTP/1.1" 200 10325 "http://localhost/developement/elgin/loginform.inc.php" "Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko"
Xampp Apache Error Log:
Failed loading C:\xampp\php\ext\php_xdebug-2.5.4-7.1-vc14.dll
6] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
Just some php files had the BOM.
Saved to BOM and re-saved to UTF-8 w no BOM
Related
I am new to posting here, so sorry if I don't make it how it should be, and I could not decide what to make the title.
So, I am new to Nginx and Docker, I am wanting to use Nginx Proxy Manager to proxy all my websites that are hosted on 'php:8.1-apache' images for now.
I am proxying a website from a docker container (Named 'ApacheDefault') running a custom image of 'php:8.1-apache' through Nginx Proxy Manager (Assets Caching disabled, Block Common Exploits disabled), and I am having issues when going through the proxy that does not appear when reaching straight to the website.
When reaching through the proxy, it randomly works and then stops working.
On the root of my website, I got /test.php which is just the phpinfo function, /index.php which handle the routing, some assets in the /assets/ folder, and a /.htaccess with
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Using 'my.domain' as an example, my domain is using Cloudflare DNS.
When reaching my.domain/test.php, I either get the regular phpinfo page or a page with this:
Warning: require_once(assets/php/config.php): Failed to open stream: No such file or directory in /var/www/html/assets/php/content.php on line 2
Fatal error: Uncaught Error: Failed opening required 'assets/php/config.php' (include_path='.:/usr/local/lib/php') in /var/www/html/assets/php/content.php:2 Stack trace: #0 /var/www/html/index.php(19): include() #1 /var/www/html/assets/php/classes/Route.php(37): {closure}('test.php') #2 /var/www/html/assets/php/classes/Router.php(40): Route->call() #3 /var/www/html/index.php(23): Router->run() #4 {main} thrown in /var/www/html/assets/php/content.php on line 2
^ "/var/www/html/assets/php/content.php" is not a file that does not exists and "assets/php/config.php" is never called in my code
The Nginx Proxy Manager log shows this (The first line landed on the error page, the second showed the regular phpinfo page):
[07/Oct/2022:16:20:22 +0000] - 200 200 - GET https my.domain "/test.php" [Client X.X.X.X] [Length 339] [Gzip -] [Sent-to ApacheDefault] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" "-"
[07/Oct/2022:16:20:23 +0000] - 200 200 - GET https my.domain "/test.php" [Client X.X.X.X] [Length 23591] [Gzip -] [Sent-to ApacheDefault] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" "-"
For some reason, the Length changes, and I can't get to understand why.
I tried:
Disabling Nginx caching from "Custom Nginx Configuration".
Disabling Nginx GZip (from "Custom Nginx Configuration") but could not manage to do it.
Enabling Cloudflare's Development Mode.
Thank you to anyone that can bring me the slightest help!
EDIT:
After testing a bit more I noticed something. When defining NPM (Nginx Proxy Manager)'s "Forward Hostname / IP" to my server raw IP or the website docker container's IP, the error does not appear anymore. The error only appears when using the docker container name as hostname instead of its IP. But I would like to rely on the hostname and not the IP because the IP can change, and seeing hostname is easier.
RE EDIT:
After removing my initial network connecting NPM & The Website Container and re creating it, it seems like it fixed the issue.
No idea why but i dont care, its fixed !
I am trying to deploy a Laravel app to Heroku with Heroku Postgress. When I deploy however, error debug pages do not seem to load any CSS or JS, making it almost impossible to extract the info I need from the error page effectively. My browser dev tool only shows an error such as
Firefox
Loading failed for the <script> with source “blob:https://...
Chrome
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
The network tool also tells me the only data coming is the HTML from the 500 response in this case.
I have made sure APP_DEBUG is true, APP_ENV is set to development and other essential variables are set. The error page looks fine when running locally and the app works fine when deployed other than the errors I need the debug page for to begin with.
here is the Procfile:
web: vendor/bin/heroku-php-apache2 public/
The console (censored and not including the trace from the error causing the page to be displayed in the first place):
2020-08-12T09:10:18.108148+00:00 app[web.1]: xxx - - [12/Aug/2020:09:10:17 +0000] "GET /xxx/1/xxx/create HTTP/1.1" 500 973197 "https://xxx.herokuapp.com/xxx/1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
2020-08-12T09:10:18.401914+00:00 app[web.1]: xxx - - [12/Aug/2020:09:10:18 +0000] "GET /favicon.ico HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
You may have misconfigured the Procfile and that is causing 500 error.
Attach the Procfile and the error from the console so that we could understand it more.
I am migrating mail servers from OVH/Centos7 to AWS/Amazon Linux; part of my setup uses roundcube webmail.
I have copied all of my config and supporting files from one instance to the other, however can not seem to make the webmail app load as expected. Anything and everything produces a 500 with no useful errors displayed anywhere.
All apps and subdirectories are owned by apache:apache
With the following error config in php.ini
display_errors = On
error_reporting = E_ALL
log_errors = On
This is the ONLY log entry created when navigating to my URL:
w.x.y.z - - [27/Dec/2018:03:56:03 +0000] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
The log entry clearly shows the 500, but produces no errors. In addition, the error log file within the roundcube directory is also empty.
The response to the client is empty, just a 500.
$curl https://mail.example.com/
Header is 500:
$curl https://mail.example.com/ --head
HTTP/1.1 500 Internal Server Error
....
If I cd to the roundcube directory and try to evaluate the index, it returns nothing:
$cd /path/to/roundcube
$php index.php
$
I have tried to disable every single roundcube plugin, in config/config.inc.php
$config['plugins'] = array();
Every single other app and web page works, after the transplant; roundcube is the only thing which is throwing 500's and not producing any error messages...
syslog is empty of relevant messages.
What can I possibly do to further investigate why this might be failing?
I have setup a local apache2 server, and it works and display correctly for any html files located at home/user/website, but it gives me an 404 error when i try to access php files.
i.e:
~/website ls
hello.php index.html test2.html test.php
127.0.1.1/index.html and 127.0.1.1/test2.html loads normally but 127.0.1.1/hello.php and 127.0.1.1/test.php gives me a 404
Theres no trace of error on the error.log file though there's a 404 GET on the access.log file:
127.0.0.1 - - [25/Sep/2014:00:35:01 -0300] "GET /hello.php HTTP/1.1" 404 273 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
I have this on the apache2.conf, not sure if it's correct:
<Directory /home/user/website>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I configured apache2 to run with hhvm trough the scripts that comes with hhvm.
My system is ubuntu 14.04
Thanks.
I found this answer on: https://github.com/facebook/hhvm/issues/3472
I had to set hhvm.server.fix_path_info = true in /etc/hhvm/server.ini, now it works.
Where is the debug information "Current character set: utf8" comming from?
It appears always first when I echoing something within my index.php (slim) script.
I really become desperate trying to suppress this.
May it caused by the .htaccess rules?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
Here my setting:
Server: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11
X-Powered-By: PHP/5.5.11
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
The relevant section of the index.php:
function echoRespnse($status_code, $response) {
$app = \Slim\Slim::getInstance();
// Http response code
$app->status($status_code);
$app->config('debug', false);
// setting response content type to json
$app->contentType('application/json');
//$app->response()->header('Content-Type', 'application/json');
echo json_encode($response);
}
Any help would be greatly appreciated