Error _server
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business server error in application Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation google server error Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Server Error Gmail
like you, helping each other. Join them; it only takes a minute: Sign up PHP Class $_SERVER Variable a Property up vote 3 down vote favorite 4 I'm developing a class and I have this structure: class
Server Error 502
userInfo { public $interval = 60; public $av_langs = null; public $ui_ip = $_SERVER['REMOTE_ADDR']; public $ui_user_agent = $_SERVER['HTTP_USER_AGENT']; public $ui_lang = null; public $ui_country = null; // non-relevant code removed } But when executing the script I get this error: Parse error: syntax error, unexpected T_VARIABLE in D:\web\www\poll\get_user_info\get_user_info.php on line 12 When I changed the 2 $_SERVER vars to simple strings the error disappeared. So what's the problem with $_SERVER in declaring class properties? Thanks server error 500 php class properties share|improve this question edited Aug 9 '11 at 13:27 Perception 55.2k7102136 asked Aug 8 '11 at 12:22 medk 2,338113351 4 The above are not variable assignments, but class property declarations. As such they cannot hold expressions. Not allowed there. You must use constants or do it in the constructor. php.net/manual/en/language.oop5.properties.php –mario Aug 8 '11 at 12:26 add a comment| 3 Answers 3 active oldest votes up vote 8 down vote accepted Use this code as a guide: public function __construct() { $this->ui_ip = $_SERVER['REMOTE_ADDR']; $this->ui_user_agent = $_SERVER['HTTP_USER_AGENT']; } share|improve this answer edited Aug 9 '11 at 13:25 Perception 55.2k7102136 answered Aug 8 '11 at 14:08 Chris Whittington 370210 add a comment| up vote 5 down vote Property can be declared only with value, not expression. You can create __construct() method, where you can initialize properties in any way. share|improve this answer answered Aug 8 '11 at 12:25 OZ_ 9,6753260 ok can you give me a simple example? I'm not very used to classes. –medk Aug 8 '11 at 12:30 I made simple set_ip() and get_ip() functions and put $ui->set_ip($_SERVER['REMOTE_ADDR']); $ui->get_ip(); and it works, but why not declaring it directly? –medk Aug 8 '11 at 12:35 1 @medk because $_SERVER['REMOTE_ADDR'] is expression, and expressions are not allowed in that scope (because any expression can
Involved Learn how you can get involved with the project. 3.1 New Features An overview of the new features and improvements in phpBB 3.1
Server Error 550
(The new version of phpBB). The Team Find out who is responsible server error 0x800ccc90 for all the mayhem. Contact Us Have a question the forums don't answer? Come here. Advertising Information if you want runtime error to advertise on phpBB.com. Find out more about the project » Downloads Latest Version Download the latest stable release of phpBB Update Packages Automatic Update packages for your phpBB release Language http://stackoverflow.com/questions/6982037/php-class-server-variable-a-property Packs Translate phpBB into (almost) any language you like Extensions Download extensions to enhance phpBB’s functionality Styles Your forums need a new look? Browse our Styles DB Official Tools Official tools by the phpBB team to assist you with your board Customise Customisation Database Our customisation database contains just about everything you might need to customise your phpBB board to your liking. In it https://www.phpbb.com/community/viewtopic.php?f=461&t=2270496 you will find Extensions (for 3.1.x), MODs (for 3.0.x), Styles, Language Packs, BBCodes, as well as various tools. Extensions (3.1.x) Guides on how to use them and how to create your own. Extensions DB Download or submit extensions to our extensions database. Modifications (3.0.x) Guides on how to use them and how to create your own. Modifications DB Download or submit modifications to our MODs database. Styles Guides on how to use them and to create your own styles. Styles DB Download or submit styles to our styles database. More resources on customising your board » Support Documentation Installation guide and the complete documentation. Knowledge Base Team and user submitted articles covering support areas. Flash Tutorials View Flash Tutorials that help you with the use of phpBB. phpBB Support The Support related areas in our community forums. IRC Support Old school? Visit the IRC support channel on freenode. International Support Find a 3rd party support site in your first language. More information on support » Development Area51 phpBB Development All Development Discussion takes place at Area51. Bug tracker, development wiki, continuous integration and other development tools are located here. Fin
when I use the temp URL I https://www.sitepoint.com/community/t/temp-url-with--server-document-root-error/30565 get this error Warning: include(/usr/local/apache/htdocs/test1.php) [function.include]: failed to open stream: No such file or directory in /home/jtiger/public_html/test.php on line 3 Warning: include() [function.include]: Failed opening '/usr/local/apache/htdocs/test1.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jtiger/public_html/test.php on line 3 BUT if I was to use this absolute path server error in the include it works. /home/jtiger/public_html/test1.php As you can figure, that is a major issue if I was to move this site form a domain to a temp url. And I want to use the Temp URL for I can use a shared SSL server error in with it. Here is my code that causes the error.include $SERVER['DOCUMENTROOT'] . '/test1.php'; Here is the code that worksinclude '/home/jtiger/public_html/cms/includes/db.inc.php'; Best I can figure, the Doc_root is calling a different file path than the absolute path/usr/local/apache/htdocs/test1.php Error/home/jtiger/public_html/test1.php Works captainccs 2013-05-15 01:01:42 UTC #2 You probably want to use $SERVER['HTTPHOST'] or $SERVER['SERVERADDR']. Try echo "
\ "; print_r ($_SERVER); echo "\ "; to see what works for you. ralphm 2013-05-15 01:04:58 UTC #3 It looks like your temporary location is on your local computer? Are you using something like XAMPP or MAMP? You can set things up locally to work the same as on your server. system 2014-10-08 04:13:58 UTC #4 Home Categories FAQ/Guidelines Terms of Service Privacy Policy Powered by Discourse, best viewed with JavaScript enabled Shop Versioning Reference Articles Premium