Chrome wants to download index.php [duplicate] - apache

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Google Chrome forces download of PHP scripts' source
I'm working on Ubuntu 11.04 with Apache2 and PHP 5.3.5.
In my document root, I have two files: a test.php printing phpinfo() and index.php for a fresh download of CodeIgniter 2.0.2
When I try to visit index.php using chrome (11.0.696.57, not Chromium), it tries to download the file. When I visit test.php using Chrome, it displays the file correctly.
When I visit these files with Firefox 4.0 on the same machine, they are BOTH displayed correctly.
Anyone else dealt with this before?
It cannot be a permissions issue as FF displays the files correctly with application type text/html.
What am I doing wrong here?

This question apparently describes the same problem, it's apparently cache related.

Your page should probably return 'Content-type: text/html' at the start (followed by a newline). Your webserver otherwise doesn't know if an image, or text or some movie is getting generated by your php script.

Related

Refused to execute script - Strict Mime type [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Newbie to mediawiki, so apologies if this is a simple error.
I have a local working fine, but on my remote (addon domain, installed in the root of that) my mediawiki install keeps giving me the console error of:
Refused to execute script from
'http://host.co.uk/load.php?debug=false&lang=en&modules=notify%2Cutil%7Cmediawiki.legacy.wikibits&skin=vector&version=5e0d755bcceb'
because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
that's in google chrome. But in Firefox i'm getting:
SyntaxError: expected expression, got '<'
This error is on line 1 and points to <!DOCTYPE html>, I'm thinking because it's trying to load html, not JS?
When I initially actioned the install, I wasn't getting any css, I solved this issue setting the session.save_path to a writeable directory.
The page URL on going to the root of the site is different from local to remote. This is because my remote uses CGI which apparently breaks the short urls: see mediaWiki: $wgUsePathInfo
local: /index.php/Main_Page
remote: /index.php?title=Main_Page
I've considered the byte order issues for LocalSettings.php, by saving in vim and checking for a space or dot before <?php, but alas no solution.
My error is described here perfectly, but being on a dedicated VPS and looking at the markup, I'm confident there is no code for tracking or advertising being injected automatically - could there be another cause?
https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms#Missing_edit_toolbar.2C_JavaScript_not_working
The errors do change when I switch from using suPHP as my handler. Changing to FCGI I'm able to get the firefox syntax error expected expression but got < in google chrome and some errors printed to the page of:
Warning: Unknown: open(/tmp/sess_cf912e9c546f88005f99ad715791fe84, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
I am confused as whilst the least errors come from suPHP, looking in php info it says my php api is CGI/FastCGI
I am using MediaWiki 1.26, php 5.5.3, Apache 2.2.31, CENTOS 6.7 x86_64 - any further details please just ask.
Your help would be greatly appreciated. Apologies if I've missed anything.
UPDATE
The url which is giving the console error:
/load.php?debug=true&lang=en&modules=j…notify%2Cutil%7Cmediawiki.legacy.wikibit‌​s&skin=vector&version=10de47153c1c
returns this javascript object:
mw.loader.state ({
"j…notify": "missing",
"util": "missing",
"mediawiki.legacy.wikibit‌​s": "missing"
})
UPDATE 2
To show any details that perhaps I'm missing I show a screen on the dev tools.
but also, on going to the concerned url again, it's now spitting out further information. I believe the information has changed because in my desperation I did composer install and reploaded the /vendor directory:
mw.loader.implement( "mediawiki.legacy.wikibits", [
"/resources/src/mediawiki.legacy/wikibits.js"
] );
mw.loader.state( {
"j…notify": "missing",
"util": "missing"
} );
UPDATE 3
UPDATE 4
Following along the advice from #TGR, I looked at the url in the network tab giving content type text/html. The part that confused me is that it doesn't match the url giving the error. However it does return 302. Looking at the same url on my local install returns:
mw.loader.implement( "jquery.accessKeyLabel", [
"/resources/src/jquery/jquery.accessKeyLabel.js"
], {}, {"brackets":"[$1]","word-separator":" "}
);
mw.loader.implement(
"jquery.client", [
"/resources/lib/jquery.client/jquery.client.js"
] );
mw.loader.implement( "mediawiki.RegExp", [
"/resources/src/mediawiki/mediawiki.RegExp.js"
] );
mw.loader.implement( "mediawiki.notify", [
"/resources/src/mediawiki/mediawiki.notify.js"
] );
mw.loader.implement( "mediawiki.util", [
"/resources/src/mediawiki/mediawiki.util.js"
] );
mw.loader.implement( "mediawiki.legacy.wikibits", [
"/resources/src/mediawiki.legacy/wikibits.js"
] );
I can also confirm that those files in the above code block are present on the problematic wiki.
UPDATE 5
I have just done a new install of the media wiki at a different subdomain. This time rather than FTP I have SSH into the server a ran wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz and then tar xvzf mediawiki-1.26.2.tar.gz. This leaves me with folder 'mediawiki-1.26.2'. I then cd mediawiki-1.26.2 followed by mv * ../ so that the wiki will work from the root. The last thing to do before I can run the install, is to correct the permissions. chown -R user:group *
I then run the install which goes very smoothly. When I get to the homepage and inspect the developer console I get the same error. This is completely fresh, no .htaccess or .conf
UPDATE 6
I felt as though there was some longevity in exploring the install directory. So on my own VPS I followed the install above, again moving files to the Root. I didn't get the same error, but I did get
SyntaxError: expected expression, got '<'
I then installed again but I left it in the subfolder of the root. This has not given me any errors. I then tried this on the live remote that i've been having issues with. Even installed in the subfolder this gives me:
SyntaxError: expected expression, got '<'
If I introduce a .htaccess file to rewrite the base url, such as RewriteRule ^/*$ %{DOCUMENT_ROOT}/mw/index.php [L], then the issue with MIME type text/html returns. Yet adding the same rule on my other install is error free.

Yii 2.0 showing Warning: Module 'mysql' already loaded in Unknown on line 0

I am new to yii 2.0. I installed my first Yii2.o application on my server and configred URL to use user friendly urls. However, I am getting
Warning: Module 'mysql' already loaded in Unknown on line 0
message when I go to the web/about/ URL. I tried to remove the base rout using "defaultRoute" in web.php but that is also not possible.
Please help me to figure out this issue.
That has nothing to do with Yii 2.0. It's a PHP misconfiguration.
Probably, you've enabled mysql extension twice. Search in your php.ini and extensions ini files:
extension=mysql.so
or
extension=mysql.dll
I had the same problem and i fix it by deleting this line in my php.ini:
extension=mysql.so
located in: /etc/php5/apache2/ and restarting apache2 service:
sudo service apache2 restart

enchant_broker_init() performance issue

I have a web site which uses enchant enchant_broker_init().
I`m not sure why but enchant_broker_init() takes something like 19~ seconds to load the page.
Once I remove this function page loads right away.
anyone has an idea why this is? or how can I debug it?
Thanks
Steps to install php enchant plugin.
APACHE
http://apache.mivzakim.net//httpd/binaries/win32/#warnings
PHP
http://windows.php.net/download/
ENABLE PHP ON APACHE
http://php.net/manual/en/install.windows.apache2.php
Enchant will not work using WAMP. ( at least for it hasn't... ).
Afterwards add the following path
share\myspell\dicts
to your PHP directory.
should look like that.
C:\PHP\share\myspell\dicts
Put the dictionary files there.
.aff
.dic

Yii:: WARNING unable to include files on some pages; please explain

I have been recently running into this issue once I uploaded my Application to an online server,
I keep receiving Warnings such as:
YiiBase::include(CJuiInputWidget.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
--OR--
YiiBase::include(YiiMailer.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
--OR--
YiiBase::include(CGridColumn.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
The real issue here is that all of these pages are working perfectly on my localhost or on other pages on
the online server.
When I hid the warnings, some pages are displayed normally while others are not, I know the error is still there.
My Localhost specs are:
XAMPP, Windows 7 OS, PHP Version 5.3.8
Online Server Specs:
XAMPP, Windows 7 OS, PHP Version 5.2.6
I am currently solving the issue by importing the required widgets in main.
What is also crazy for example is that CGridColumn and CJuiInputwidget are working perfectly on other pages ,
I have made sure that case sensitivity is considered.
Can anyone point me in the right direction or give me any pointers or thoughts on what is happening, any tips or advices are amazingly appreciated!
Here is also a stack trace of whats going on:
**Stack trace:
#0 D:\...\yii\framework\YiiBase.php(395): spl_autoload_call()
#1 D:\...\yii\framework\YiiBase.php(395): autoload()
#2 D:\...\yii\framework\YiiBase.php(296): autoload()
#3 D:\...\yii\framework\YiiBase.php(196): import()
#4 D:\...\yii\framework\zii\widgets\grid\CGridView.php(363):
createComponent()**
as you can see the major issue has to do with the autoload
Thank you, for taking the time to read this,
Could be the common problem of developing on windows, hosting on Linux. Windows doesn't care about the case of the filename, Linux does. I'd have a check through any widgets you've written or are including and any custom package definitions you have. Just ensure the case is correct.
Well I added this to the Index.php in order to hide warnings...very dirty in my POV
ini_set('error_reporting', E_NOTICE);
and the problem dissolved, still I can't comprehend what was happening!

zend framework project shows blank page without any errors

i created a simple project with zf and it works fine, but when i copy it to other pc
it just show a blank page without any page or errors ?
my zf version is 1.9 and in other pc zf version 1.9 too
what do you do about this problem?
Do you have error reporting enabled on your machine?
Make sure, that you have these lines in your php.ini file:
error_reporting = E_ALL
display_errors = on
It will help you to find the problem by showing the error.
If it doesn't help, try to put this code in your index.php in public directory
ini_set('display_errors', 1);
Also make sure, that DocumentRoot points to your Zend project public folder.
Are the memory limits the same on both servers? I have seen similar results using php (with zend, albeit). When I run out of memory, just a blank white screen is the result.
This error is caused because your server is running version 4 of PHP, change to version 5 and it will work.