qooxdoo : XMLHttpRequest Origin null is not allowed by Access-Control-Allow-Origin - php

I have a qooxdoo project that fetches JSON from an online server using the following codes:
var url = "http://www.example.com/json.php?q=parameter_here";
var store = new qx.data.store.Json(url,"GET", "text/plain");
store.addListener("changeModel", function(ev) {
console.log("changeModel()");
console.log("getData", ev.getData());
});
store.addListener("error", function(ev) {
console.log("error", ev.getData());
});
store.addListener("changeState", function(ev) {
console.log("state", ev.getData());
});
I'm using iMac, and the local path is /Users/SomeUser/Path/To/index.html
I tried to load the index.html in Chrome browser as usual, but failed, as Chrome blocks the Javascript as Origin null is not allowed by Access-Control-Allow-Origin. After I read the answer from this question, I know I have to host it in a web server. Therefore I set up a XAMPP for this site.
Since my XAMPP has few existing Alias, I add a new Alias for this site, as follow:
<Directory "/Users/SomeUser/Path/To">
Options All
AllowOverride All
Require local
Order allow,deny
Allow from all
</Directory>
Alias /myalias "/Users/SomeUser/Path/To"
When I set up the Alias like this, 403 Forbidden is reported. Then, I found this question on SO, but the answers didn't help. Still 403 Forbidden.
My goal is to load the site in local XAMPP server. What did I miss? When I upload the folder to a web server online, it works fine.
In XAMPP Apache error_log, it shows:
[Fri Apr 19 17:51:09 2013] [error] [client 127.0.0.1] (13)Permission
denied: access to /myalias/index.html denied
For the file, its permission is:
drwxr-xrwx 7 SomeUser staff 238 Apr 2 16:48 .
Note: I don't want to change the Chrome launch options to override the Access-Control-Allow-Origin policy.

You do realize that all you have to do is to go to your xampp/mamp install folder, locate the htdocs folder and inside of it create a new folder with your project(say test) then access it in your browser like: http://localhost/test/ right ?

Related

Cannot access .php on my server. Permission Denied

I just recently changed to Digital Ocean to have full Shell access and stuff to advance my knowledge of code. I made a script and removed .php from url's to make them look nicer in the url bar and as well i have had to create a ".php" file so i can re-route users to the login.php page. Since i have created the .php file i keep getting a 403 error. Access Denied. Its the same error that shows up when you place "Deny from all" in a .htaccess to block traffic from viewing a includes folder or etc. The error i get in the error log is:
[Fri Jun 30 00:42:21.056280 2017] [authz_core:error] [pid 2808]
[client 76.111.178.215:50805] AH01630: client denied by server
configuration: /var/www/affattraction.com/public_html/login/admin/.php
If anyone has encountered this or knows how i can give permission to access the page ".php" it will be greatly appreciated! This worked on my old cPanel.
Thanks!

How do you modify the apache 403 error displayed when a directory is forbidden

Say you deny access to certain folders or files and you want to serve your custom error messages instead of something like this
You don't have permission to access /classes/classname.php on this server.
Apache/2.2.22 (Ubuntu) Server at webdev Port 8080.
Look into Apache configuration - specifically, ErrorDocument.
You'll add a line to your .htaccess file that looks like this:
ErrorDocument 403 /errors/forbidden.html

Apache/PHP downloading index.php rather than displaying..?

https://coinsafe.io/
I recently purchased and applied an SSL certificate.
After getting it all set-up, when I go to the site it downloads the index.php file...
There is code in the file but I cleared it out to see if it was my code causing it, and it downloaded it again and it was empty as expected.
The weird thing is when it downloads, it's not a .php file and it's called "download"
How can I fix this?
Edit
I am now getting this error [Sat Nov 16 04:09:07 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
when I try to start Apache.
Basically, if Apache is trying to send a PHP file to your visitor, it means that Apache doesn't realise that the PHP is a script file.
This in turn means that apache hasn't loaded the php module, even if it's installed.
If you've done nothing else, there should be some sort of hint in your apache error.log, usually located in /var/log/apache2/ on ubuntu.
Also, in ubuntu php, you should have sym-links to php.conf and .load in /etc/apache2/mods-enabled/

Permission access to php page

I have website on one host(host A) and another website which I include with iframe(on host B).
From that iframe I would like to go to one of my pages from my host A, but I get this error
You don't have permission to access
/pages/online.php on this server.
Additionally, a 404 Not Found error
was encountered while trying to use an
ErrorDocument to handle the request.
How can I fix that? It worked good when I was using another server.
Apache error logs:
[Fri Jul 01 03:24:37 2011] [error] [client some-ip-here] File does not exist: /home/etcorg/public_html/proba/500.shtml, referer: proba.etc.org.rs/pages [Fri Jul 01 03:24:37 2011] [error] [client x.x.x.x] SoftException in Application.cpp:256: File "/home/etcorg/public_html/proba/pages/online.php" is writeable by group, referer: somepage.com
I think your host has program that checks that the permissions aren't set too high (over 644). Thus the error. Change all the rights to 644 for files and 755 for directories.
Check the reading rights on this file on the server for Apache user.
Try to use full URL in your iframe (ex: http://www.SiteB.com/pages/online.php)
The error
You don't have permission to access /pages/online.php on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
means that location /pages/online.php could not be accessed because of lacking permissions. If the file is supposed to be a PHP script, it should be readable (but highly probably not writable) by the web server process.
In addition, the server tried to use custom error page for the HTTP 500 internal server error situation but the server was incorrectly configured and displaying the custom error page failed as a result. (Error message hints about ErrorDocument configuration directive which makes this server almost certainly an Apache server.)
To fix the first error, you may need to change access bits for the script and to fix the second error, you must check where Apache ErrorDocument configuration points to. Perhaps there's a typo in the configuration or some file is missing?

Server error, why this error message appears when i use .htaccess

when I use .htaccess file inside a folder named admin with the following code
AuthName "Alertme"
AuthType Basic
AuthUserFile /mobs/.htpasswd
require valid-user
and .htpasswd file with following code
rajasekar:66Acdia7gE1to
While accessing the file inside folder, it gives server error, The server encountered an internal error and was unable to complete your request
why is this happening. help me
Most likely your Apache config does now allow Auth* directives in .htaccess in that directory and/or location. You can check for sure why looking in the error_log for that host. There'll be a line that looks like:
[Wed Dec 02 22:13:14 2009] [alert] [client x.x.x.x] /path/leading/to/.htaccess: AuthName not allowed here
This error will show up as a "500 Internal Server" error for any client attempting to access that particular server/directory.
You will need to add an "AllowOverride AuthConfig" so Apache will accept the Auth directives in the .htaccess. Details are here in the Apache docs.
Make sure that /mobs/.htpasswd is absolute (not relative to your webroot) path on your filesystem
This usually happens when your htaccess and/or htpasswd file can't be read by apache. Either because the user apache is running under doesn't have the needed rights on these files.

Categories