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