J. Antonio banderas Tue Aug 03 03:15:34 -0400 2010

Subject: Help me please, ActiveRecord doesn't work on production server. The namespace character breaks the application.

Hi Guys,

I started working with ActiveRecord a few days ago and I found it very helpful. I made some tests on my laptop and everything worked fine. But when I decided to upload the code to the production server(Hosting Service), it didn't work. I'm getting the next error messages:

Unexpected character in input: '\' (ASCII=92) state=1 in /home/a2036470/public_html/shopping_cart/Config/Inc.php on line 63

Parse error: syntax error, unexpected T_STRING in /home/a2036470/public_html/shopping_cart/Config/Inc.php on line 63

That line in my code is this:
$_ActiveRecordConfig = ActiveRecord\Config::instance();

I can see that the problem is with the "\" character. I have tried in many hosting services and I'm still getting the same error. And also I tried to disable the directive: "magic_quotes_gpc". I couldn't do that neither runtime nor .htaccess file.
On my local machine "magic_quotes_gpc" is set to "off". But on the hosting servers it is set to "on". And I have not achieve to disable it. In some attempts I have only gotten t a 500 error (using .htaccess).

At this moment I'm very frustrated, because I found it very interesting and helpful. And it seems I'm not going to bring it to a production environment.

I think it is a bad idea to use the character "\" as a namespace separator. And that is my problem.
I wonder if there is another character or way to do reference to a namespace without using that character.

I hope you guys can help me, give me a solution or another option.
Congratulations to the creator(s) of this amazing tool.
Thanks in advance.


Alberto Ruffo Tue Aug 03 06:51:22 -0400 2010

Hi,
maybe, your production servers don't have php 5.3.

Regards

Alberto

Michael Smith Tue Aug 03 20:45:23 -0400 2010

Definitely because you don't have PHP5.3 installed, php.activerecord needs PHP5.3 as it uses the new namespaces feature primarily (plus late static binding if memory serves). These 2 features are not available on any previous versions.

As for not being able to disable magic_quotes_gpc, I'd find a new host sooner rather then later as that is one of THE most irritating "features" in the world.

Your best bet for fixing these issues would be to use a different production web host, I don't know of many that offer PHP5.3 on a shared hosting service though, (I currently have a DreamHost server with a custom PHP install) if you find any do let us know!

(1-2/2)