Recently LZ is doing a thinkphp project, with the development of Wamp. Porting the code to Ubuntu is a problem and the verification code cannot be displayed. Before also encountered such a problem, is nothing more than the GD library is not loaded, or the session write permissions issues.
The solution to these two problems first:
①GD Library not loaded
Installing the GD Library
Apt-get Install PHP5-GD
Search gd.so in the/usr/lib/php5/20090626+lfs/directory, you need to modify Php.ini,php.ini in the/ETC/PHP5/APACH2 directory.
Then modify the php.ini:
Add another line
Restart APACH2:
/ETC/INIT.D/APACH2 restart
②session Write permission Issues
<? PHP $sessionpath Session_save_path (); // Get the current session's Save path echo$sessionpath;? >
The Modify permission is 777.
Add: There are children's shoes that is the BOM problem again this I also said, may be a lot of children's shoes may not know what the BOM, I also explained below.
Bom:
To identify Unicode files, Microsoft recommends that all Unicode files begin with a ZERO WIDTH nobreak SPACE (U+feff) character. This acts as a "signature" or "byte order mark (Byte-order Mark,bom)" To identify the encoding and byte order used in the file.
Linux/unix does not use the BOM because it destroys the syntax conventions of existing ASCII files. (– This is why a blank line appears on this page)
Dom is not a good thing is a data signature, a string of strings, often lead to blank lines on the page, especially when PHP file introduction require_once and include.
③linux find the file containing the BOM header and clear the BOM header command
Locate the file that contains the BOM header, as follows:
Click (here) to collapse or open
Grep-r-i-l $ ' ^\xef\xbb\xbf '.
\XEF\XBB\XBF is a 16 binary representation of the UTF8 BOM
This command removes the BOM header from the current directory and all subdirectories.
Click (here) to collapse or open
Find. -type F-exec sed-i ' s/\xef\xbb\xbf//' {} \;
Another way:
Click (here) to collapse or open
echo -ne ' \xef\xbb\xbf123456 ' | awk ' {if (nr==1) sub (/^\xef\xbb\xbf/, ""); print} '
Detailed explanation of BOM
Http://www.cnblogs.com/chengmo/archive/2010/10/30/1864004.html
This article is reproduced from http://blog.csdn.net/kunpeng1987/article/details/72876347
thinkphp The verification code cannot be loaded or the verification code error problem is resolved under Ubuntu