Deployment to Linux server and $_GET variable

Hello.

I have a problem with my Yii aplication that works great on my Mac but on the linux server I have one problem.

I have this urlManager configuration:




'urlManager' => array(

            'urlFormat' => 'path',

            'rules' => array(

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

                '<controller:\w+>/<id:\d+>' => '<controller>/view',

                //Special case

                'mailingsubscription/subscribe/<url_string:\w+>' => 'mailingsubscription/subscribe',

                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

            ),

        ),



The problem is with the : ‘mailingsubscription/subscribe/<url_string:\w+>’ => ‘mailingsubscription/subscribe’,

I have a problem with the $_GET[‘url_string’] data in the subscribe function.

On my mac the $_GET variable has the value of:




Array

(

    [url_string] => 32b201ff

)



But on the linux server the $_GET variable has the value of:




Array

(

    [32b201ff] => 

)



Any ideas?

Thanks

Is the rewrite module enabled on your Linux server?

Yes it is.

But I dont use it in this application.

I am viewing the page with index.php in the url: domain.com/index.php/mailingSubscription/subscribe/32b201ff

I can’t think of a way to solve your problem right now, but just to clarify I think you are indeed using url rewrite for that url format. Otherwise you should use domain.com/index.php?r=mailingSubscription/subscribe&url_string=32b201ff

Although, if the “’<controller:\w+>/<id:\d+>’ => ‘<controller>/view’,” pattern is working fine, then I guess it shouldn’t be a rewrite issue.

Mauriciorivera is right: you are using rewrite.

I don’t know what the issue is, but you can figure it out by comparing the configuration between the two webservers.

Doesn’t have to be web server configuration, could also be PHP.

I have never seen anything like that before, maybe some PHP module or even an Apache module.

I would start with a basic test not using Yii just simple PHP trying to reproduce the problem in different ways trying to rule out different components.

EG: get_test.php


<?php

echo '<pre>' . print_r($_GET, TRUE) . '</pre>';

?>

Then run it with some get variables eg: /get_test.php?some=123&test=not_yii

If that all looks good. Then move your test into the the top of index.php before yii is run. Then move it after yii is run. If it does not work at the top of the index file then it could be some sort of url rewrite problem. you could also try removing your .htaccess file and testing and then putting it back and see how things change.

I would also compare setup EG: phpinfo vs phpinfo and $_SERVER variables for unexpected differences.

Good luck, that is a strange one.

Thank you all for your help.

If fixed it by changing from:


'mailingsubscription/subscribe/<url_string:\w+>' => 'mailingsubscription/subscribe',

to (upper case S):


'mailingSubscription/subscribe/<url_string:\w+>' => 'mailingSubscription/subscribe',

When I changed urlFormat to "get" instead of "path" everything was working fine.

On the forum I found alot of linux problems because of case sensitivity so I changed the name of the controler in the rules to mailingSubscription because the controller name is MailingSubscriptionController.php

But I still don’t know why the $_GET variable got messed up. Maybe it’s a bug in the framework.