Use php on Linux to obtain apk information.

Source: Internet
Author: User

Use php on Linux to obtain apk information.

Recently, I am working on an apk store. After the user uploads the apk, the system automatically reads the apk information (package name, version number, and so on). The background language is php, php needs to call the system's aapt command to read apk information. The method for installing aapt on Linux is as follows:

1. In the future, aapt and apktool will be copied to/usr/bin /.

2. Run aapt and report the following error:
-Bash:/usr/bin/aapt:/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Solution: Check the package in which the required file is located.
Yum whatprovides */ld-linux.so.2
In the retrieved list, select install glibc-2.12-1.132.el6_5.1.i686
Yum-y install glibc-2.12-1.132.el6_5.1.i686
-- Skip-broken

3. Run:
Yum install glibc. i686

At this time, the aapt still reports an error.
Aapt: error while loading shared libraries: libz. so.1: cannot open shared object file: No such file or directory
Solution: Same as above
Yum whatprovides */libz. so.1 -- skip-broken
If a package version conflict exists, run: yum install zlib.

4. An error is reported at this time.
Aapt: error while loading shared libraries: libstdc ++. so.6: cannot open shared object file: No such file or directory
Solution:
Yum whatprovides */libstdc ++. so.6
Yum-y install libstdc ++-4.4.7-4. el6.i686
Conflict
Yum-y install libstdc *
Yum-y install libstdc ++-4.4.7-4. el6.i686
This is basically OK.

 

Aapt software: http://pan.baidu.com/s/1pJkEqcb


Who has the PHP code to obtain the MAC Nic information of the client in LINUX?

Put the following file that saves the PHP extension on the server for access.
<? Php
// Obtain the original MAC address of the NIC

Class GetMacAddr {

Var $ return_array = array (); // returns a string array with a MAC address.
Var $ mac_addr;

Function GetMacAddr ($ OS _type ){
Switch (strtolower ($ OS _type )){
Case "linux ":
$ This-> forLinux ();
Break;
Case "solaris ":
Break;
Case "unix ":
Break;
Case "aix ":
Break;
Default:
$ This-> forWindows ();
Break;

}

$ Temp_array = array ();
Foreach ($ this-> return_array as $ value ){

If (
Preg_match ("/[0-9a-f] [0-9a-f] [:-]". "[0-9a-f] [0-9a-f] [:-]". "[0-9a-f] [0-9a-f] [:-]". "[0-9a-f] [0-9a-f] [:-]". "[0-9a-f] [0-9a-f] [:-]". "[0-9a-f] [0-9a-f]/I", $ value,
$ Temp_array )){
$ This-> mac_addr = $ temp_array [0];
Break;
}

}
Unset ($ temp_array );
Return $ this-> mac_addr;
}

Function forWindows (){
@ Exec ("ipconfig/... remaining full text>

Use php code in linux to decompress files. Chinese files cannot be decompressed. For other solutions, see.

If the file name is in Chinese, don't drag others together. The basic principle of the server is that Chinese file names cannot appear.

Because the common default encoding of file names in Linux is UTF-8. However, in many cases, the file names in the compressed package are character-encoded for the current system IO. In addition, many software programs do not provide file name encoding conversion when extracting and writing files.
The result is a problem.

Now, you may use your current encoding to re-compress the file. Of course, the Windows encoding is definitely not UTF8. It can only be Linux, or try to use the English version, must be in English only ). Otherwise, we will use the compression protocol that supports file name encoding to re-compress, but I am not clear about the specific support.

The final method is to write and decompress the code by yourself, get the file name in the code, and convert it by yourself.

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.