Execute the following code to generate a unique UID
<span>$fp</span> = <span>popen</span>("/xxx/bin/tools/uuidgen system", "r"<span>);// </span><span>$uid</span> = <span>fread</span>(<span>$fp</span>, 40960<span>); </span><span>pclose</span>(<span>$uid</span>);
Problem: The returned result $uid is empty. In fact, after executing the popen function, the content resource(39) of type (stream)
can be returned.
resource popen ( string
$command
, string $mode
)
Parameters: $command command, $mod mode.
Opens a pipe to the process spawned by forking the execution of the given command command.
If the command to be executed is not found, a legal resource is returned, which allows access to any error messages returned by the shell.
/* Add redirection to get standard error output stderr. */
<span>$fp</span> = <span>popen</span>("/xxx/bin/tools/uuidgen system 2>&1", "r");
In this way, you will see the output error error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
means that the system does not know which directory libcurl.so is placed in.
Solution:
Add the directory where libcurl.so is located in /etc/ld.so.conf.
General so files will be in the directory /usr/local/lib (users can customize the directory), so in /etc/ld.so.conf Add the line /usr/local/lib (or user-defined directory),
Finally, save /etc/ld.so.conf and execute the command [root@www]# /sbin/ldconfig -v to take effect.
Reference: http://blog.csdn.net/kangear/article/details/9141481