php4 No static member
Such an error occurred in the background of the php web page. After checking, no corresponding error was found. The website tests locally on its own are completely normal, and such an error occurs after it is uploaded to the space. Even the verification code cannot be seen, and similar errors include Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/users//admin/ on line 6
If the server is version 4.0, if there is "public", remove "public". There will be no error. If "public" is a variable that defines, change "public" to "var".
Recently, I am building a whole-site content management system (see the homepage of this site), and I am also building a friend’s office building information management system! To be honest, I have only used php for more than half a year to develop, and I have insufficient experience, but I have been working in WEB for several years. When I first came into contact with php, I still had php3. PHP3 did not support session, nor did I have the concept of face objects, only a lot of functions! At first, I was wandering among many web scripts. Asp, php, and jsp were already three-legged. Of course, perl and cgi were too luxurious for students who were still beginners at that time. In fact, I also liked a lot of functions at that time, just like learning Dos commands at that time. However, compared to Asp, php3 has no session or face objects. Many small companies are using Asp, which is why they did not choose php at the beginning. The biggest improvement of php4 is to add the idea of face objects and increase the session management between the server and the client. Nowadays, most domestic host providers are still on the php4 version, but php5 can be regarded as a language with a real meaning!
So, returning to php is to develop with php5. I have not installed the php4 version on my machine, but it is the php4 version on the host. So during the development process, I had to be careful and carefully understand the characteristics between them.
1. PHP4 does not have static, private, protect, etc. modifications, so all these must be removed when uploading the developed program to the host!
2. The object call in PHP4 cannot be written as $obj->method_a()->method_b(); while PHP5 can. The meaning of this statement is to call $obj's method, which will return an object and then execute the object's method_b() method.
Then if I upload it to my host, I have to change all such statements to
$tempobj=$obj->method_a();
$tempobj->method_b();
3. In the variable parsing of complex strings, the method attributes that can be parsed in php5, etc., such as:
$a="{$db->isconnected}";
And php4 cannot run correctly.
4. In PHP5, you can use constructing and destructuring magic functions such as:
<?php
class MyDestructableClass {
function __construct() {
print "In constructor\n";
$this->name = "MyDestructableClass";
}
function __destruct() {
print "Destroying " . $this->name . "\n";
}
}
$obj = new MyDestructableClass();
?>
There is no function with the same name as the class name, and only the function with the same name as the class name is the constructor, and the constructor with the same name as the class name.
PHP5 has also added a lot to PHP4, such as PD, and PHP6 may have made more extensions (I haven't tried PHP6 yet). I think PHP will become more powerful and more suitable for WEB-based development.
A brief discussion on the difference between PHP5 and PHP4:
1. Not 100% backward compatible
In php5, although most of the PHP4 code should be run without modification, you should pay attention to the following non-backward compatible changes:
There are some new keywords.
strrpos() and strripos() now use the entire string as the needle.
Illegal use of string offsets results in E_ERROR instead of E_WARNING. An example of illegal use: $str = ‘abc'; unset($str[0]);.
array_merge() is changed to accept only arrays. If a non-array variable is passed in, an E_WARNING message will be issued for each such parameter. Be careful because your code may issue E_WARNING wildly.
The PATH_TRANSLATED server variable is no longer secretly set in Apache2 SAPI, which is contrary to the case in PHP 4. If Apache does not generate this value, it is set to the same value as the SCRIPT_FILENAME server variable. This modification is intended to comply with CGI specifications. For more information, refer to the instructions for $_SERVER['PATH_TRANSLATED'] in the manual. This issue also affects versions of PHP >= 4.3.2.
The Tokenizer extension no longer defines the T_ML_COMMENT constant. If error_reporting is set to E_ALL, PHP will generate a message. Although T_ML_COMMENT has never been used, it is still defined in PHP 4. In PHP 4 and PHP 5 // and are both parsed as T_COMMENT constants. However, PHPDoc-style annotations have been parsed by PHP since PHP 5 and are recognized as T_DOC_COMMENT.
If variables_order includes "S", $_SERVER should be generated with argc and argv. If the user specially configured system does not create $_SERVER, then this variable will certainly not exist. The change is that no matter how variables_order is set, argc and argv are always available in the CLI version. Originally, the CLI version did not always produce global variables $argc and $argv.
Objects without attributes are no longer considered "empty".
In some cases, classes must be defined before use. This only happens when some new features of PHP 5 (such as interfaces) are used. In other cases, the behavior has not changed.
get_class(), get_parent_class() and get_class_methods() now return class/method names that are consistent with the definition name (case sensitive), which may cause problems for old scripts that rely on previous behavior (class/method names always return lowercase). A possible workaround is to search all of these functions in the script and use strtolower().
Case sensitive changes also apply to magic constants __CLASS__, __METHOD__ and __FUNCTION__. The value will be returned strictly according to the defined name (case sensitive).
ip2long() returns FALSE when passing an illegal IP as a parameter, no longer -1.
If there are functions defined in the include file, these functions can be used in the main file regardless of whether they are before or after the return() directive. If the file is contained twice, PHP 5 issues a fatal error because the function has been defined, while PHP 4 ignores this. Therefore, it is recommended to use include_once() instead of checking whether the file has been included and that it has conditional return in the included file.
include_once() and require_once() are normalized in Windows, so including and include only once.
Examples: strrpos() and strripos() now use the entire string as the needle
<?php
var_dump(strrpos(‘ABCDEF',‘DEF')); //int(3)
var_dump(strrpos(‘ABCDEF',‘DAF')); //bool(false)
?>
Example: Objects without attributes are no longer considered "empty"
<?php
class test { }
$t = new test();
var_dump(empty($t)); // echo bool(false)
if ($t) {
// Will be executed
}
?>
Example: In some cases, classes must be defined before use
<?php
//works with no errors:
$a = new a();
class a {
}
//throws an error:
$a = new b();
interface c{
}
class b implements c {
}
?>
II. CLI and CGI
Some changes were made to the CLI and CGI file names in PHP 5. In PHP 5, the CGI version was renamed (formerly ), and now the CLI version in the home directory is the CLI version (formerly cli/).
A new model has been introduced in PHP 5:. This is the same as the CLI version, except that php-win does not output anything, so the console is not provided (the "dos window" does not flash on the screen). This behavior is similar to php-gtk.
In PHP 5, the CLI version always produces global variables $argv and $argc regardless of how it is set. Even setting register_argc_argv to off does not affect the CLI.
See command line mode.
3. Migrate configuration files
Since the name of the ISAPI module has been changed from php4xxx to php5xxx, some modifications are needed to be made to the configuration file. The CLI and CGI file names have also been changed. For more information, please see the corresponding chapter.
Migrating Apache configuration is extremely simple. Follow the following example to check the modifications that need to be made:
Example: Migrating Apache configuration files to PHP 5
# Change the following line: LoadModule php4_module /php/sapi/ # Change it to this line: LoadModule php5_module /php/
If the web server is running PHP in CGI mode, you should note that the name of the CGI version has been changed from . In Apache, it should be changed as follows:
Example: Migrating Apache configuration files to PHP 5, CGI mode
# Change the following line: Action application/x-httpd-php "/php/" # Change it to this line: Action application/x-httpd-php "/php/"
In other web servers, the name of the CGI or ISAPI module needs to be modified.
4. New functions
PHP 5 has some new functions. Here is the list:
Arrays:
array_combine() - Create a new array with an array as the key name and another array as the value
array_diff_uassoc() - calculates the difference in the array and uses the user-provided callback function for additional index checks
array_udiff() - Use callback function to compare data to calculate the difference in arrays
array_udiff_assoc() - Calculate the differences in the array and perform additional index checks. Use callback functions to compare data
array_udiff_uassoc() - Calculate the differences in the array and perform additional index checks. Data comparison and index check are done using callback functions.
array_walk_recursive() - Recursively use user functions for each member of an array
array_uintersect_assoc() - calculates the intersection of the array and performs additional index checks. Use callback functions to compare data
array_uintersect_uassoc() - calculates the intersection of the array and performs additional index checks. Both data and indexes are compared with callback functions.
array_uintersect() - calculates the intersection of an array. Use callback functions to compare data
InterBase:
ibase_affected_rows() - Returns the number of rows affected by the previous query
ibase_backup() - initiate a background task in the service manager and return immediately
ibase_commit_ret() - commit a transaction but not close
ibase_db_info() - Request statistics about the database
ibase_drop_db() - Delete a database
ibase_errcode() - Return an error code
ibase_free_event_handler() - Cancel a registered event handler
ibase_gen_id() - increments the specified generator and returns its new value
ibase_maintain_db() - Execute a maintenance command on the database server
ibase_name_result() - Assign a name to the result set
ibase_num_params() - Returns the number of parameters for a prepared query
ibase_param_info() - Returns the parameter information of a prepared query
ibase_restore() - initiate a restore task in the service manager and return immediately
ibase_rollback_ret() - Rewind a transaction and retain transaction context
ibase_server_info() - Request statistics about the database server
ibase_service_attach() - Connect to the service manager
ibase_service_detach() - Disconnect from the service manager
ibase_set_event_handler() - Register a callback function to be called when an event is published
ibase_wait_event() - Wait for the database to publish an event
iconv:
iconv_mime_decode() - decode MIME header field
iconv_mime_decode_headers() - Decode multiple MIME header fields at once
iconv_mime_encode() - Compress MIME header field
iconv_strlen() - Returns the character count in the string
iconv_strpos() - Find the first occurrence of substring position in the stack
iconv_strrpos() - Find the last occurrence of substring position in the stack
iconv_substr() - Take a part from the string
Streams:
stream_copy_to_stream() - Copy data from one stream to another stream
stream_get_line() - Read a line from the stream according to the given separator
stream_socket_accept() - accepts a socket connection established by stream_socket_server()
stream_socket_client() - Open a socket connection for an Internet or Unix domain
stream_socket_get_name() - Get the local or remote sockets name
stream_socket_recvfrom() - Get data from socket (regardless of whether the connection has been established or not)
stream_socket_sendto() - Send a message to the socket (regardless of whether the connection has been established or not)
stream_socket_server() - Create a socket for an Internet or Unix domain server
Date/Time:
IDate() - Format local intervening into integers
date_sunset() - Calculate the sunset time for the specified date and place
date_sunrise() - T calculates the sunrise time of the specified date and place
time_nanosleep() - Tingchi executing process several seconds and several nanoseconds
Strings:
str_split() - Split a string into an array
strpbrk() - Search for any character in a given character set in a string
substr_compare() - Compare two strings in binary form, starting from the offset of the first string until it reaches the length of length, customize whether the case-sensitive comparison is
Other:
convert_uudecode() - decode uuencoded string
convert_uuencode() - uuencode string
curl_copy_handle() - Copy a cURL handle and all its parameters
dba_key_split() - Separate a key into a string array
dbase_get_header_info() - Get header information of the dBase database
dbx_fetch_row() - Get the rows set to DBX_RESULT_UNBUFFERED in the result set
fbsql_set_password() - Modify the password of the specified user
file_put_contents() - Write a string to a file
ftp_alloc() - Allocate space for files to be uploaded
get_declared_interfaces() - Returns all defined items as array
get_headers() - Get all header information when the server responds to HTTP requests
headers_list() - Returns a list of all sent or ready to send response headers
http_build_query() - generates a URL-encoded request string
image_type_to_extension() - Get the file name suffix based on the image-type returned by getimagesize(), exif_read_data(), exif_thumbnail(), exif_imagetype()
imagefilter() - Apply filters to images
imap_getacl() - Get the ACL of the specified mailbox
ldap_sasl_bind() - Use SASL to bind to an LDAP directory
mb_list_encodings() - Returns all supported character sets as an array
pcntl_getpriority() - Get priority for any process
pcntl_wait() - Waits on or returns the status of a forked child as defined by the waitpid() system call
pg_version() - Returns an array containing client, protocol, and server versions
php_check_syntax() - Check the syntax of the specified file
php_strip_whitespace() - Returns the source code that has been removed comments and blanks
proc_nice() - Modify the superior level of the current process
pspell_config_data_dir() - Modify the location of the language file
pspell_config_dict_dir() - Modify the position of the main word list
setrawcookie() - Send a cookie value without url encoding
scandir() - All subdirectories and files in the specified directory in the column
snmp_read_mib() - Read and split a MIB file in an available MIB tree
sqlite_fetch_column_types() - Returns the column type in a table as an array
Note: The Tidy extension library's API has also been significantly adjusted
V. New instructions
PHP 5 introduces some new instructions in . The list is as follows:
mail.force_extra_parameters - Force the specified parameter to be value-added as additional parameters to the sendmail library. These parameters always replace the fifth parameter of mail(), even in safe mode
register_long_arrays - Allow/disable PHP to register outdated $HTTP_*_VARS variables
session.hash_function - Select a hash function (MD5 or SHA-1)
session.hash_bits_per_character - defines how many bits are stored in each character (from 4 to 6) when converting binary hash data into readable format
zend.ze1_compatibility_mode - Enable Zend Engine 1 generation (PHP 4) compatibility mode
VI. Database
There are some changes in PHP 5 about databases (MySQL and SQLite).
The MySQL client connection library is no longer bound in PHP 5 because of authorization and some other issues.
There is a new extension library, MySQLi (modified version of MySQL), designed to work under MySQL 4.1 and later.
Since PHP 5, the SQLite extension library is built into PHP. SQLite is an embedded SQL database engine, not a client connection library that connects large database servers such as MySQL or PostgreSQL. The SQLite library directly reads and writes database files on disk.
7. New object model
There is a new object model in PHP 5. The way PHP handles objects is completely rewritten, allowing for better performance and more features. Previous versions of PHP had the same object processing as primitive types (such as integers and strings). The disadvantage of this method is that the entire object is copied semantically when the variable is assigned or passed as a parameter to the method. In the new method, the object is referenced by a handle, not a value (the handle can be treated as an identifier of the object).
Many PHP programmers simply don't realize this copy quirk of the old object model, so most PHP applications can run or make only minor modifications.
See "Class and Objects" for the documentation for the new object model.
Basic knowledge of PHP: Comparison of the configuration similarities and differences between PHP4 and PHP5
In the process of configuring php4 or php5, the steps of php4 and 5 are roughly the same, but there are some differences in the configuration content. Compiling in LINUX and other environments, generally speaking, as long as the compilation options are correct, the configuration is also correct; in Windows configuration, you need to pay attention to the following differences:
1. and content comes from China Webmaster Information Network ()
This file must be copied to the bin directory of apache or the system directory
2. File loading module
Examples are as follows:
# For PHP4 +
LoadModule php4_module d:/www/webserver/php4/sapi/
AddType application/x-httpd-php .php content comes from China Webmaster Information Network ()
# For PHP4 +
LoadModule php4_module d:/www/webserver/php4/sapi/
AddType application/x-httpd-php .php
# where d:/www/webserver/php4 is the directory where php is located.
# For PHP5 +
LoadModule php5_module d:/www/webserver/php5/
AddType application/x-httpd-php .php
# For PHP5 +
LoadModule php5_module d:/www/webserver/php5/
AddType application/x-httpd-php .php
# where d:/www/webserver/php5 is the directory where php is located.
3. Different ways to load mysql
In php4 and previous versions, mysql is integrated in php;
In PHP5 (including BETA) version, mysql is loaded as a module and needs to be set to load, for example
extension_dir = "D:/www/WebServer/PHP5/ext/"
extension=php_mysql.dl l
In addition, PHP4 and PHP5 both require support in the system directory. If the version is wrong, even if you set the correct extension_dir and php_mysql.dll parameters, it will cause an error that phpp_mysql.dll cannot be found when apache starts.
Such an error occurred in the background of the php web page. After checking, no corresponding error was found. The website tests locally on its own are completely normal, and such an error occurs after it is uploaded to the space. Even the verification code cannot be seen, and similar errors include Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/users//admin/ on line 6
If the server is version 4.0, if there is "public", remove "public". There will be no error. If "public" is a variable that defines, change "public" to "var".
Recently, I am building a whole-site content management system (see the homepage of this site), and I am also building a friend’s office building information management system! To be honest, I have only used php for more than half a year to develop, and I have insufficient experience, but I have been working in WEB for several years. When I first came into contact with php, I still had php3. PHP3 did not support session, nor did I have the concept of face objects, only a lot of functions! At first, I was wandering among many web scripts. Asp, php, and jsp were already three-legged. Of course, perl and cgi were too luxurious for students who were still beginners at that time. In fact, I also liked a lot of functions at that time, just like learning Dos commands at that time. However, compared to Asp, php3 has no session or face objects. Many small companies are using Asp, which is why they did not choose php at the beginning. The biggest improvement of php4 is to add the idea of face objects and increase the session management between the server and the client. Nowadays, most domestic host providers are still on the php4 version, but php5 can be regarded as a language with a real meaning!
So, returning to php is to develop with php5. I have not installed the php4 version on my machine, but it is the php4 version on the host. So during the development process, I had to be careful and carefully understand the characteristics between them.
1. PHP4 does not have static, private, protect, etc. modifications, so all these must be removed when uploading the developed program to the host!
2. The object call in PHP4 cannot be written as $obj->method_a()->method_b(); while PHP5 can. The meaning of this statement is to call $obj's method, which will return an object and then execute the object's method_b() method.
Then if I upload it to my host, I have to change all such statements to
Copy the codeThe code is as follows:
$tempobj=$obj->method_a();
$tempobj->method_b();
3. In the variable parsing of complex strings, the method attributes that can be parsed in php5, etc., such as:
$a="{$db->isconnected}";
And php4 cannot run correctly.
4. In PHP5, you can use constructing and destructuring magic functions such as:
Copy the codeThe code is as follows:
<?php
class MyDestructableClass {
function __construct() {
print "In constructor\n";
$this->name = "MyDestructableClass";
}
function __destruct() {
print "Destroying " . $this->name . "\n";
}
}
$obj = new MyDestructableClass();
?>
There is no function with the same name as the class name, and only the function with the same name as the class name is the constructor, and the constructor with the same name as the class name.
PHP5 has also added a lot to PHP4, such as PD, and PHP6 may have made more extensions (I haven't tried PHP6 yet). I think PHP will become more powerful and more suitable for WEB-based development.
A brief discussion on the difference between PHP5 and PHP4:
1. Not 100% backward compatible
In php5, although most of the PHP4 code should be run without modification, you should pay attention to the following non-backward compatible changes:
There are some new keywords.
strrpos() and strripos() now use the entire string as the needle.
Illegal use of string offsets results in E_ERROR instead of E_WARNING. An example of illegal use: $str = ‘abc'; unset($str[0]);.
array_merge() is changed to accept only arrays. If a non-array variable is passed in, an E_WARNING message will be issued for each such parameter. Be careful because your code may issue E_WARNING wildly.
The PATH_TRANSLATED server variable is no longer secretly set in Apache2 SAPI, which is contrary to the case in PHP 4. If Apache does not generate this value, it is set to the same value as the SCRIPT_FILENAME server variable. This modification is intended to comply with CGI specifications. For more information, refer to the instructions for $_SERVER['PATH_TRANSLATED'] in the manual. This issue also affects versions of PHP >= 4.3.2.
The Tokenizer extension no longer defines the T_ML_COMMENT constant. If error_reporting is set to E_ALL, PHP will generate a message. Although T_ML_COMMENT has never been used, it is still defined in PHP 4. In PHP 4 and PHP 5 // and are both parsed as T_COMMENT constants. However, PHPDoc-style annotations have been parsed by PHP since PHP 5 and are recognized as T_DOC_COMMENT.
If variables_order includes "S", $_SERVER should be generated with argc and argv. If the user specially configured system does not create $_SERVER, then this variable will certainly not exist. The change is that no matter how variables_order is set, argc and argv are always available in the CLI version. Originally, the CLI version did not always produce global variables $argc and $argv.
Objects without attributes are no longer considered "empty".
In some cases, classes must be defined before use. This only happens when some new features of PHP 5 (such as interfaces) are used. In other cases, the behavior has not changed.
get_class(), get_parent_class() and get_class_methods() now return class/method names that are consistent with the definition name (case sensitive), which may cause problems for old scripts that rely on previous behavior (class/method names always return lowercase). A possible workaround is to search all of these functions in the script and use strtolower().
Case sensitive changes also apply to magic constants __CLASS__, __METHOD__ and __FUNCTION__. The value will be returned strictly according to the defined name (case sensitive).
ip2long() returns FALSE when passing an illegal IP as a parameter, no longer -1.
If there are functions defined in the include file, these functions can be used in the main file regardless of whether they are before or after the return() directive. If the file is contained twice, PHP 5 issues a fatal error because the function has been defined, while PHP 4 ignores this. Therefore, it is recommended to use include_once() instead of checking whether the file has been included and that it has conditional return in the included file.
include_once() and require_once() are normalized in Windows, so including and include only once.
Examples: strrpos() and strripos() now use the entire string as the needle
Copy the codeThe code is as follows:
<?php
var_dump(strrpos(‘ABCDEF',‘DEF')); //int(3)
var_dump(strrpos(‘ABCDEF',‘DAF')); //bool(false)
?>
Example: Objects without attributes are no longer considered "empty"
<?php
class test { }
$t = new test();
var_dump(empty($t)); // echo bool(false)
if ($t) {
// Will be executed
}
?>
Example: In some cases, classes must be defined before use
Copy the codeThe code is as follows:
<?php
//works with no errors:
$a = new a();
class a {
}
//throws an error:
$a = new b();
interface c{
}
class b implements c {
}
?>
II. CLI and CGI
Some changes were made to the CLI and CGI file names in PHP 5. In PHP 5, the CGI version was renamed (formerly ), and now the CLI version in the home directory is the CLI version (formerly cli/).
A new model has been introduced in PHP 5:. This is the same as the CLI version, except that php-win does not output anything, so the console is not provided (the "dos window" does not flash on the screen). This behavior is similar to php-gtk.
In PHP 5, the CLI version always produces global variables $argv and $argc regardless of how it is set. Even setting register_argc_argv to off does not affect the CLI.
See command line mode.
3. Migrate configuration files
Since the name of the ISAPI module has been changed from php4xxx to php5xxx, some modifications are needed to be made to the configuration file. The CLI and CGI file names have also been changed. For more information, please see the corresponding chapter.
Migrating Apache configuration is extremely simple. Follow the following example to check the modifications that need to be made:
Example: Migrating Apache configuration files to PHP 5
# Change the following line: LoadModule php4_module /php/sapi/ # Change it to this line: LoadModule php5_module /php/
If the web server is running PHP in CGI mode, you should note that the name of the CGI version has been changed from . In Apache, it should be changed as follows:
Example: Migrating Apache configuration files to PHP 5, CGI mode
# Change the following line: Action application/x-httpd-php "/php/" # Change it to this line: Action application/x-httpd-php "/php/"
In other web servers, the name of the CGI or ISAPI module needs to be modified.
4. New functions
PHP 5 has some new functions. Here is the list:
Arrays:
array_combine() - Create a new array with an array as the key name and another array as the value
array_diff_uassoc() - calculates the difference in the array and uses the user-provided callback function for additional index checks
array_udiff() - Use callback function to compare data to calculate the difference in arrays
array_udiff_assoc() - Calculate the differences in the array and perform additional index checks. Use callback functions to compare data
array_udiff_uassoc() - Calculate the differences in the array and perform additional index checks. Data comparison and index check are done using callback functions.
array_walk_recursive() - Recursively use user functions for each member of an array
array_uintersect_assoc() - calculates the intersection of the array and performs additional index checks. Use callback functions to compare data
array_uintersect_uassoc() - calculates the intersection of the array and performs additional index checks. Both data and indexes are compared with callback functions.
array_uintersect() - calculates the intersection of an array. Use callback functions to compare data
InterBase:
ibase_affected_rows() - Returns the number of rows affected by the previous query
ibase_backup() - initiate a background task in the service manager and return immediately
ibase_commit_ret() - commit a transaction but not close
ibase_db_info() - Request statistics about the database
ibase_drop_db() - Delete a database
ibase_errcode() - Return an error code
ibase_free_event_handler() - Cancel a registered event handler
ibase_gen_id() - increments the specified generator and returns its new value
ibase_maintain_db() - Execute a maintenance command on the database server
ibase_name_result() - Assign a name to the result set
ibase_num_params() - Returns the number of parameters for a prepared query
ibase_param_info() - Returns the parameter information of a prepared query
ibase_restore() - initiate a restore task in the service manager and return immediately
ibase_rollback_ret() - Rewind a transaction and retain transaction context
ibase_server_info() - Request statistics about the database server
ibase_service_attach() - Connect to the service manager
ibase_service_detach() - Disconnect from the service manager
ibase_set_event_handler() - Register a callback function to be called when an event is published
ibase_wait_event() - Wait for the database to publish an event
iconv:
iconv_mime_decode() - decode MIME header field
iconv_mime_decode_headers() - Decode multiple MIME header fields at once
iconv_mime_encode() - Compress MIME header field
iconv_strlen() - Returns the character count in the string
iconv_strpos() - Find the first occurrence of substring position in the stack
iconv_strrpos() - Find the last occurrence of substring position in the stack
iconv_substr() - Take a part from the string
Streams:
stream_copy_to_stream() - Copy data from one stream to another stream
stream_get_line() - Read a line from the stream according to the given separator
stream_socket_accept() - accepts a socket connection established by stream_socket_server()
stream_socket_client() - Open a socket connection for an Internet or Unix domain
stream_socket_get_name() - Get the local or remote sockets name
stream_socket_recvfrom() - Get data from socket (regardless of whether the connection has been established or not)
stream_socket_sendto() - Send a message to the socket (regardless of whether the connection has been established or not)
stream_socket_server() - Create a socket for an Internet or Unix domain server
Date/Time:
IDate() - Format local intervening into integers
date_sunset() - Calculate the sunset time for the specified date and place
date_sunrise() - T calculates the sunrise time of the specified date and place
time_nanosleep() - Tingchi executing process several seconds and several nanoseconds
Strings:
str_split() - Split a string into an array
strpbrk() - Search for any character in a given character set in a string
substr_compare() - Compare two strings in binary form, starting from the offset of the first string until it reaches the length of length, customize whether the case-sensitive comparison is
Other:
convert_uudecode() - decode uuencoded string
convert_uuencode() - uuencode string
curl_copy_handle() - Copy a cURL handle and all its parameters
dba_key_split() - Separate a key into a string array
dbase_get_header_info() - Get header information of the dBase database
dbx_fetch_row() - Get the rows set to DBX_RESULT_UNBUFFERED in the result set
fbsql_set_password() - Modify the password of the specified user
file_put_contents() - Write a string to a file
ftp_alloc() - Allocate space for files to be uploaded
get_declared_interfaces() - Returns all defined items as array
get_headers() - Get all header information when the server responds to HTTP requests
headers_list() - Returns a list of all sent or ready to send response headers
http_build_query() - generates a URL-encoded request string
image_type_to_extension() - Get the file name suffix based on the image-type returned by getimagesize(), exif_read_data(), exif_thumbnail(), exif_imagetype()
imagefilter() - Apply filters to images
imap_getacl() - Get the ACL of the specified mailbox
ldap_sasl_bind() - Use SASL to bind to an LDAP directory
mb_list_encodings() - Returns all supported character sets as an array
pcntl_getpriority() - Get priority for any process
pcntl_wait() - Waits on or returns the status of a forked child as defined by the waitpid() system call
pg_version() - Returns an array containing client, protocol, and server versions
php_check_syntax() - Check the syntax of the specified file
php_strip_whitespace() - Returns the source code that has been removed comments and blanks
proc_nice() - Modify the superior level of the current process
pspell_config_data_dir() - Modify the location of the language file
pspell_config_dict_dir() - Modify the position of the main word list
setrawcookie() - Send a cookie value without url encoding
scandir() - All subdirectories and files in the specified directory in the column
snmp_read_mib() - Read and split a MIB file in an available MIB tree
sqlite_fetch_column_types() - Returns the column type in a table as an array
Note: The Tidy extension library's API has also been significantly adjusted
V. New instructions
PHP 5 introduces some new instructions in . The list is as follows:
mail.force_extra_parameters - Force the specified parameter to be value-added as additional parameters to the sendmail library. These parameters always replace the fifth parameter of mail(), even in safe mode
register_long_arrays - Allow/disable PHP to register outdated $HTTP_*_VARS variables
session.hash_function - Select a hash function (MD5 or SHA-1)
session.hash_bits_per_character - defines how many bits are stored in each character (from 4 to 6) when converting binary hash data into readable format
zend.ze1_compatibility_mode - Enable Zend Engine 1 generation (PHP 4) compatibility mode
VI. Database
There are some changes in PHP 5 about databases (MySQL and SQLite).
The MySQL client connection library is no longer bound in PHP 5 because of authorization and some other issues.
There is a new extension library, MySQLi (modified version of MySQL), designed to work under MySQL 4.1 and later.
Since PHP 5, the SQLite extension library is built into PHP. SQLite is an embedded SQL database engine, not a client connection library that connects large database servers such as MySQL or PostgreSQL. The SQLite library directly reads and writes database files on disk.
7. New object model
There is a new object model in PHP 5. The way PHP handles objects is completely rewritten, allowing for better performance and more features. Previous versions of PHP had the same object processing as primitive types (such as integers and strings). The disadvantage of this method is that the entire object is copied semantically when the variable is assigned or passed as a parameter to the method. In the new method, the object is referenced by a handle, not a value (the handle can be treated as an identifier of the object).
Many PHP programmers simply don't realize this copy quirk of the old object model, so most PHP applications can run or make only minor modifications.
See "Class and Objects" for the documentation for the new object model.
Basic knowledge of PHP: Comparison of the configuration similarities and differences between PHP4 and PHP5
In the process of configuring php4 or php5, the steps of php4 and 5 are roughly the same, but there are some differences in the configuration content. Compiling in LINUX and other environments, generally speaking, as long as the compilation options are correct, the configuration is also correct; in Windows configuration, you need to pay attention to the following differences:
1. and content comes from China Webmaster Information Network ()
This file must be copied to the bin directory of apache or the system directory
2. File loading module
Examples are as follows:
# For PHP4 +
LoadModule php4_module d:/www/webserver/php4/sapi/
AddType application/x-httpd-php .php content comes from China Webmaster Information Network ()
# For PHP4 +
LoadModule php4_module d:/www/webserver/php4/sapi/
AddType application/x-httpd-php .php
# where d:/www/webserver/php4 is the directory where php is located.
# For PHP5 +
LoadModule php5_module d:/www/webserver/php5/
AddType application/x-httpd-php .php
# For PHP5 +
LoadModule php5_module d:/www/webserver/php5/
AddType application/x-httpd-php .php
# where d:/www/webserver/php5 is the directory where php is located.
3. Different ways to load mysql
In php4 and previous versions, mysql is integrated in php;
In PHP5 (including BETA) version, mysql is loaded as a module and needs to be set to load, for example
extension_dir = "D:/www/WebServer/PHP5/ext/"
extension=php_mysql.dl l
In addition, PHP4 and PHP5 both require support in the system directory. If the version is wrong, even if you set the correct extension_dir and php_mysql.dll parameters, it will cause an error that phpp_mysql.dll cannot be found when apache starts.