14 Summary of headache problems for beginners in PHP (1) _php tutorial

Source: Internet
Author: User
Today for everyone to serve to make PHP beginners Headache problem Summary, the following 14 questions to hope for PHP beginners helpful.

1. Variables cannot be passed between pages

Get,post,session Automatic global variables are turned off in the latest PHP version, so the variables to be submitted from the previous page are obtained using $_get[' foo '],$_post[' foo '],$_session[' foo '. Of course, you can also modify the automatic global variable to ON (php.ini to register_globals = on), or it is better to force yourself to be familiar with the new wording, considering compatibility.

2, Win32 apache2 using the Get method to pass Chinese parameters will be an error

test.php?a= Hello &b= You

Passing parameters can cause an internal error

Workaround: "Test.php?a=". UrlEncode (Hello). " &b= ". UrlEncode (you're good too)

3, Win32 under the session 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 files resulting in the session can not be used

Change it to an absolute path, for example Session.save_path = C:windowstemp

4. Display error message

When php.ini display_errors = on and error_reporting = E_all, all errors and hints are displayed, preferably open for error correction when debugging, if you use the previous PHP notation, most of the error information is about undefined variables. Variables are called before they are assigned, and the solution is to detect or block.

For example, $foo can be displayed, if (Isset ($foo)) echo $foo or echo @ $foo

5, Win32 Mail () cannot send email

Configured under Linux SendMail can be sent, in Win32 need to call the SMTP server to send e-mail, modify php.ini SMTP = IP//ip is not with authentication features of the SMTP server (difficult to find online), PHP the best way to send mail is to send the socket directly to the other email server instead of forwarding the server.

6, the initial installation of MySQL if you do not set a password, you should 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, he may be several reasons: 1, you are using the header before the Pring or Echo 2. You have a blank line 3 in front of your current file. You may include a file with a blank line or output at the end of the file.

8. No changes after changing php.ini

Restart the Web server, such as Iis,apache and so on, before applying the latest settings

9, PHP installed on the 2003 (ISAPI installation method request expert advice)

PHP4 's php4isapi.dll seems to be in conflict with 2003 and can only be installed in CGI mode:

Step One, First www.php.net under a setup program, I am Loaded is: Php-4.2.3-installer.exe, you can also go to the latest version, before installing Php-4.2.3-installer.exe to ensure that your IIS6.0 boot up and be able to access. After installation, in the default website---application configuration;

Step Two: Click Web Service Extensions--new Web service extensions;

Step three: Extension-->php, then add;

Step four: Find the path to php.exe add up;

Step five: OK to do it;

Step six: Select PHP's service extensions, then click Allow.

10, sometimes the SQL statement does not work, the database operation failed

The easiest way to debug, echo the SQL, to see if the value of the variable can be obtained.

1

http://www.bkjia.com/PHPjc/446703.html www.bkjia.com true http://www.bkjia.com/PHPjc/446703.html techarticle today for everyone to serve to make PHP beginners Headache problem Summary, the following 14 questions to hope for PHP beginners helpful. 1, the page can not pass the variable get,post,session in the latest ...

  • 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.