Magic constants not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Magic constants not working

Post by JasonTC »

I have an interesting/frustrating situation. I have some code that works on one server but doesn't work on another server. That in itself isn't terribly shocking. It's WHAT isn't working that's deeply puzzling:
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /home/jason/ard/api_examples/api/kintera_api.php on line 27
At appears that magic constants don't work anymore. I don't get it.

On the server where the code works, I have PHP 5.3.0. Where it doesn't work, 5.2.10. Any idea why this could be happening?

Thanks,
Jason
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Magic constants not working

Post by AbraCadaver »

__DIR__ added in 5.3.0. Try:

Code: Select all

dirname(__FILE__);
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

Re: Magic constants not working

Post by JasonTC »

That's it. Thanks!
Post Reply