14 Most headaches for PHP beginners _ PHP Tutorial

Source: Internet
Author: User
The fourteen most headaches for PHP beginners. [1] The get and post variables cannot be passed between pages. in the latest php version, automatic global variables are disabled, therefore, to obtain and submit the variables from the previous page, use $ _ GET [fo [1] to transfer the variables between pages.
The get, post, and session automatic global variables are disabled in the latest php version. therefore, to obtain and submit the variables from the previous page, use $ _ GET ['foo']. $ _ POST ['foo'], $ _ SESSION ['foo. Of course, you can also change the automatic global variable to on (php. ini is changed to register_globals
= On); considering compatibility, it is better to force yourself to familiarize yourself with the new writing method.
[2] In Win32, an error occurs when apache2 uses the get method to pass Chinese parameters:
Test. php? A = Hello & B = you
Passing parameters will cause an internal error.
 
Solution: "test. php? A = ". urlencode (hello)." & B = ". urlencode (you can also)
.............
[3] The session under win32 does not work normally
Php. ini Default session. save_path =/tmp
This is obviously a configuration in linux. In win32, php cannot read or write session files, and the session cannot be used. you can change it to an absolute path, for example, session. save_path.
= C: windows emp
[4] displaying error messages
When display_errors of php. ini is On and error_reporting =
All errors and prompts will be displayed during E_ALL. it is best to enable it for error correction during debugging. if you use php to write errors, most of them are about undefined variables. A prompt is displayed before the variable is assigned a value. The solution is to detect or block the variable.
For example, if $ foo is displayed, you can use if (isset ($ foo) echo $ foo or echo @ $ foo.
[5] Win32 mail () cannot send email
Sendmail configured in linux can be sent. In win32, you need to call the smtp server to send an email and modify the SMTP = ip address of php. ini.
// The ip address is an smtp server without verification (it is hard to find it online)
The best solution for sending emails in php is to directly send emails to the recipient's email server using socket instead of forwarding the server.
[6] If the password is not set for the newly installed mysql, use update mysql. user set password = "yourpassword" where
User = "root" change password
[7] header already sent
This error usually occurs when you use the HEADER. it may be due to several reasons: 1. you PRING or ECHO before using the HEADER. 2. you have a blank line before the current file. 3. you may INCLUDE a file. this error may also occur if there are blank lines at the end of the file or the output .!

[8] php. ini has not changed.
Restart the web server, such as IIS and Apache, and then apply the latest settings.
[9] install php on 2003 (for how to install ISAPI, please advise)
Php4isapi. dll of PHP4 seems to be in conflict with 2003. it can only be installed in CGI mode.

Automatic get, post, and session automatic global variables are disabled in the latest php version. therefore, to obtain and submit the variables from the previous page, use $ _ GET ['Fo...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.