Questions about PHP writing 64-bit extensions

Source: Internet
Author: User

1, originally in 32-bit desktop system to write a PHP extension, has been debugging in the local, you can use the normal.

2, after publishing to the server, the extension is never loaded, through Phpinfo view does not load, the server is Ubuntu 14.04 64-bit version

3. Open the error display item in php.ini

Display_startup_errors = On

Error_log =/etc/php_errors.log

The above settings can display error messages when PHP starts, such as when the extension is not loaded successfully.

4. Stop and restart the PHP5-FPM

Command: Stop PHP5-FPM

Command: Start PHP5-FPM

5, you can see the Php_errors.log file has the following similar error message

Wrong ELF class:elfclass32 in Unknown on line 0

The explanation is that because the extension is 32-bit and the system is 64-bit, the loading error

6, download the PHP source version, and then the extension compiled again

Command: wget http://cn2.php.net/distributions/php-5.6.5.tar.gz

Command: Tar zxvf php-5.6.5.tar.gz

Command: CD Php-5.6.5/ext

7, re-follow the php extension method, create an extension, see other information on the Web

8. Replace the original extended code copy with the previous

9. Perform compilation

Command: Phpize, if the prompt command does not exist, use the command installation: Apt-get install Php5-dev

Command:./configure

Command: Make

If there is no error, a so file is generated under the Modules folder, which is the extended module.

10. Stop and start php5-fpm again

It is already possible to show that the extension successfully loaded successfully.

The above diary records down, easy to find problems later. The main experience is how to find the wrong, if the extension is not loaded successfully, you can open the log on the above method to find the wrong, so quickly solve the problem.

Questions about PHP writing 64-bit extensions

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.