Different PHP versions behalves differently. The only two distribution on
php.net is 4.4.4 and 5.2.0. The experience of the article describes class difference between 4.4.4 and 5.2.0 is that:
1). class members variable is decorated by "private" in 5.2.0, as "var" in 4.4.4
2). class functions is decorated by "public function" in 5.2.0, as "function" in 4.4.4
Several days ago, i wrote a php proxy for wap.roboo.com to transfer jsp response to a php server. And grabed a HTTPRequest class from google, the class code is as follows:
class HTTPRequest{ var $_fp; // HTTP socket var $_url; // full URL var $_host; // HTTP host var $_protocol; // protocol (HTTP/HTTPS) var $_uri; // request URI var $_port; // port // scan url function _scan_url() { .... } // constructor function HTTPRequest($url) { $this->_url = $url; $this->_scan_url(); } // download URL to string function DownloadToString() { .... }}I use Slackware 11 to do most works, slack use php 4.4.4 by default. the HTTPRequest works ok on my machine. After deploy it on another fedora machine which has php 5.0 by default, it fails. Then I updated it to php 5.2.2, with the help of one colleague, I changed the class as follows to support 5.2.2:
class HTTPRequest{ private $_fp; // HTTP socket private $_url; // full URL private $_host; // HTTP host private $_protocol; // protocol (HTTP/HTTPS) private $_uri; // request URI private $_port; // port // scan url public function _scan_url() { .... } // constructor public function HTTPRequest($url) { $this->_url = $url; $this->_scan_url(); } // download URL to string public function DownloadToString() { .... }}By the way, i use vi(vim actually) to edit source, just use :0,$s/var/private/g , :0,$s/function/public function/g to do the substitution.
After disabled SELinux on fedora , it works ok.