yiiSkeletonApp error 404 on all links - yii

I downloaded yiiSkeletonApp from https://github.com/travisstroud/yiiSkeletonApp
managed to get localhost/dev working but when i click on login / register i get an Error 404.
the login url and register url's are http://localhost/dev/login and http://localhost/dev/user/create
in my protectd/config/main.php i have this..
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
),
also the files protected/views/site/login.php and protected/views/user/create.php do exist
here is the error message
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
folder content:
localhost/dev/
- assets/
- css/
- images/
- protected/
- themes/
- yii/
- facebook-channel.php
- index.php
- index-test.php
- README.md

You site is configured to use hard coded path's it seems. so its referring to the wrong paths.
try accessing this url from localhost,
localhost/dev/index.php/site/login
localhost/dev/index.php/site/user/create
There is no issue with urlManager. You can refer to this link to understand URL Manager of yii.
http://www.yiiframework.com/doc/guide/1.1/en/topics.url

Related

Bigcommerce API start

first of all, sorry for this silly question
but I am new to use big commerce API and I searched and found many threads but not works for me .
the composer created a directory vendor
then its root I have to create a file index.php and put this code but it's showing me the blank page
<?php
require 'vendor/autoload.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array(
'store_url' => 'https://store-xxxx.mybigcommerce.com/api/v2/',
'username' => 'xxxx',
'api_key' => 'xxxx'
));
Bigcommerce::verifyPeer(false);
$ping = Bigcommerce::getTime();
if ($ping) echo $ping->format('H:i:s');
$filter = array("page" => 3, "limit" => 30);
$products = Bigcommerce::getProducts($filter);
?>
Please, someone, explain all steps with the easy understandable process ?
Sometimes it's giving
Fatal error: Class 'Bigcommerce_Api' not found in C:\xampp\htdocs\bigcommerceapi\index.php on line 30
I followed this community
https://c9.io/oschino/bigcommerce-api-php-oauth
when I clicking the single file link it's showing 404 not found where from I can download big commerce.php file
Also, I want to know if composer created a whole PHP API then is it it is necessary to download big commerce PHP API from Github ?
I have checked the folder structure and files are same in vendor folder and big commerce git hub files.
Please help
I got solution the bigcoomerce store URL call process is now changed
I changed
Bigcommerce::configure(array(
'store_url' => 'https://store-xxxx.mybigcommerce.com/api/v2/',
'username' => 'xxxx',
'api_key' => 'xxxx'
));
to like this
Bigcommerce::configure(array(
'store_url' => 'https://store-xxxx.mybigcommerce.com',
'username' => 'xxxx',
'api_key' => 'xxxx'
));

Yii is handling $_GET for clean url only

i am trying to allow accessing the $_GET for both clean url and normal get request in YII (Yii 1.1.14), so for example if i have a controller Cities and action getCities that var_dump($_GET) only
1- http://example.com/cities/getCities/country_id/100
==> the output is array(1) { ["country_id"]=> string(3) "100" }
2- http://example.com/cities/getCities?country_id=100
==> the output is array(0) { }
my urlManager is
'urlManager' => array(
'class' => 'ext.localeurls.LocaleUrlManager',
'languageParam' => 'lang', // Name of the parameter that contains the desired language when constructing a URL
'urlFormat' => 'path',
'showScriptName' => false,
'caseSensitive' => false,
'rules'=>array(
'login'=>'/home/login'
)
),
how could i allow Yii to recognize $_GET in both cases above?
EDIT
i am using nginx 1.6. GET params (?x=y) is working fine on other Yii projects, only this project doesn't. I changed the web-server to apache, and i got it working on this project!!! although this project has the same nginx configurations like others!!

Csrf token isn't being created in subdomain

I activated csrf protection on my project which runs on Yii framework.
Csrf token is being created when base domain runs like "www.example.com".
But it isn't being created when the subdomain runs like "admin.example.com".
The configuration:
'components'=>array(
'request' => array(
'class' => 'application.components.HttpRequest',
'enableCsrfValidation' => true,
),
...
What is the problem in my code or is it about the server?
You can configure the CSRF cookie params in the request component in your main.php configuration:
'components' => array(
'request' => array(
'csrfCookie' => array(
'domain' => '.example.com',
),
),
),
Check out the other cookie options. You may also have to tweak the cookie path. This may also be helpful:
How do browser cookie domains work?

SSL for a website in Kohana

I have a website in Kohana 3.0.7 and I have purchased SSL certificate. I have marked the success page to which pay pal transaction details are returned with https. After the database is updated, I added following code -
$this->request->redirect('business/fnc_manage');
But this page is loaded with https and not loaded properly on Google Chrome.
If I try as following, it gives me 500 error -
header("Location:"+url::base()+"business/fnc_manage");
exit();
How can I get rid of this ? Does this mean that I'll have to ensure that all the resources loaded should be served over https ?
If yes, then I might have to change all the paths. How can I do it for HTML helpers ?
I have not tried it but I'd say changing the base_url in your bootstrap.php could help:
Kohana::init(array(
'base_url' => 'https://yoururlhere.com',
'index_file' => FALSE,
'charset' => 'utf-8',
'cache_dir' => APPPATH . 'cache',
'errors' => TRUE,
'profile' => Kohana::$environment !== Kohana::PRODUCTION,
'caching' => Kohana::$environment === Kohana::PRODUCTION,
));

How to show zf2 errors?

I've reinstall my system and now when something wrong in zf2 i cant see the error on the page only in nginx error log, the display_errors On and display_startup_errors On, in php.ini, maybe something with my php-fpm settings?
And in the simple php file not in zf2 i have see the errors!
You need enable the following options in your config
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
)
Remember turn off this in a production environment
ini_set('display_errors', true); in my index.php now show me the errors
Zend framework 2 will merge configs from all loaded modules, so you need to ensure that you already set 'display_exceptions' (if that key exists) to true in all modules's config file.
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
)
You can see which modules are loaded in your application.config.php file
You can combine the above with an environment check:
Add this to your public/index.php at the top:
$env = getenv('APP_ENV') ?: 'production';
if($env == "development") {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
}
And this one to your public/.htaccess:
SetEnv "APP_ENV" "development"
Add this to your public/index.php
error_reporting(E_ALL | E_STRICT);
In my case Zend errors and NGinX - php5 fpm, work like this:
Only I put in public/index.php (#AlloVince)
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Without If(){...}
But If only to put above code, display error, will give this:
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /usr/local/nginx/html/ZendSkeletonApplication/module/Album/src/Album/Controller/AlbumController.php on line 12
Another thing! Set up this code: (#To Nong)
'display_not_found_reason' => true,
'display_exceptions' => true,
in module.config.php like this:
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
'display_not_found_reason' => true,
'display_exceptions' => true,
),
),
I get all errors of an error log on screen:
Fatal error: Uncaught exception 'Zend\View\Exception\InvalidArgumentException' with message 'Invalid path provided; must be a string, received boolean' in /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/View/Resolver/TemplatePathStack.php:201 Stack trace: #0 /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/View/Resolver/TemplatePathStack.php(149): Zend\View\Resolver\TemplatePathStack->addPath(true) #1 /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/Mvc/Service/ViewTemplatePathStackFactory.php(38): Zend\View\Resolver\TemplatePathStack->addPaths(Array) #2 [internal function]: Zend\Mvc\Service\ViewTemplatePathStackFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'viewtemplatepat...', 'ViewTemplatePat...') #3 /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(939): call_user_func(Array, Object(Zend in /usr/local/nginx/html/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 946
I didn't touch config file as php-fpm in system (Ubuntu 14.04).