14 questions that most make PHP beginners headache

Source: Internet
Author: User
Tags urlencode win32
Cannot pass variables between "1" pages
Get,post,session the automatic global variable is turned off in the latest PHP version, so the submitted variable from the previous page is to be obtained using $_get[' foo '],$_post[' foo '],$_session[' foo '. Of course, you can also modify the automatic global variable to open (PHP.ini changed to Register_globals
= on); it's better to force yourself to be familiar with the new wording, considering compatibility.
"2" Win32 under Apache2 there is an error in passing the Chinese parameter with the Get method:
test.php?a= Hello &b= You
Passing parameters can cause an internal error
 
Solution: "Test.php?a=". UrlEncode (Hello). " &b= ". UrlEncode (you are also good)
.............
The session under "3" Win32 does not work properly
php.ini default Session.save_path =/tmp
This is obviously the configuration under Linux, Win32 PHP can not read and write session file causes session can not use, change it to an absolute path, such as Session.save_path
= c:windows EMP
"4" displays an error message
When php.ini display_errors = on and error_reporting =
When E_all, all errors and prompts will be displayed, and it is best to turn it on when debugging, if you use the previous PHP coding error message is mostly about undefined variables. Variables are prompted before they are assigned, and the solution is to detect or mask them.
For example, $foo can be displayed, if (Isset ($foo)) echo $foo or echo @ $foo
"5" Win32 Mail () cannot send e-mail
Under Linux configured SendMail can be sent, under Win32 need to invoke the SMTP server to send e-mail, modify the php.ini SMTP = IP
IP is an SMTP server with no authentication capability (hard to find on the Internet)
The best solution for PHP to send mail is to send it directly to the other email server without forwarding the server.
"6" first installed MySQL if you do not set a password, you should use the update mysql.user set password= "YourPassword" where
User= "Root" to modify the password
"7" header already sent
This error usually occurs when you use the header, he may be several reasons: 1, you are Pring or Echo 2 before using header. You have a blank line 3 in front of your current file. You may include a file with a blank line at the end of the file, or an error in the output.

No change after "8" change php.ini
Restart the Web server, such as Iis,apache, and so on, before applying the latest settings.
"9" PHP installed on 2003 (ISAPI installation method kindly advise)
PHP4 's php4isapi.dll seems to be in conflict with 2003 and can only be installed in CGI mode

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.