Cách tải xuống các tiện ích mở rộng PHP

Viết phần mở rộng PHP1. Thiết lập môi trường xây dựng PHP của bạn trên Linux2. Tạo phần mở rộng PHP Skeleton3. Xây dựng và cài đặt tiện ích mở rộng PHP4. Xây dựng lại tiện ích mở rộng cho Production5. Nội dung tệp bộ xương mở rộng6. Chạy thử nghiệm tiện ích mở rộng PHP7. Thêm chức năng mới8. Các cấu trúc PHP cơ bản9. Mảng PHP10. Bắt lỗi rò rỉ bộ nhớ11. Quản lý bộ nhớ PHP12. Tài liệu tham khảo PHP13. Sao chép trên Write14. Các lớp và đối tượng PHP15. Sử dụng OOP trong Tiện ích mở rộng mẫu16 của chúng tôi. Nhúng dữ liệu C vào các đối tượng PHP17. Ghi đè Trình xử lý Đối tượng18. Câu trả lời cho các câu hỏi mở rộng phổ biến

3. Xây dựng và cài đặt tiện ích mở rộng PHP

Khung mở rộng này có thể được biên dịch mà không có bất kỳ thay đổi nào. Lệnh “phpize” đầu tiên là một phần của bản dựng PHP mà chúng ta đã tạo ở bước đầu tiên. [Nó vẫn phải ở trong PATH. ]

$ phpize
$ ./configure
$ make
$ make install

Các lệnh này sẽ xây dựng tiện ích mở rộng được chia sẻ của chúng tôi “thử nghiệm. so” và sao chép nó vào thư mục thích hợp của bản cài đặt PHP của bạn. Để tải nó, chúng ta cần thêm một dòng vào php tùy chỉnh của mình. ban đầu

$ vi ~/php-bin/DEBUG/etc/php.ini

Thêm dòng sau

extension=test.so

Kiểm tra xem tiện ích mở rộng đã được tải và hoạt động chưa. Lệnh “php -m” in danh sách các tiện ích mở rộng đã tải.  

$ php -m | grep test
test

Chúng tôi cũng có thể chạy các chức năng được xác định trong tiện ích mở rộng “thử nghiệm” của chúng tôi.  

$ php -r ‘test_test1[];’
The extension test is loaded and working!
$ php -r ‘echo test_test2[“world\n”];’
Hello world

Bây giờ, thật hợp lý khi bắt đầu theo dõi các thay đổi nguồn của chúng tôi bằng hệ thống kiểm soát phiên bản. [Tôi thích GIT hơn. ]

php_bz2.dll bzip2 compression functions None php_calendar.dll Calendar conversion functions None php_crack.dll Crack functions None php_ctype.dll ctype family functions None php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, ssleay32.dll [bundled] php_dba.dll DBA: DataBase [dbm-style] Abstraction layer functions None php_dbase.dll dBase functions None php_dbx.dll dbx functions php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must be loaded after php_mbstring.dll in php.ini. php_fbsql.dll FrontBase functions None php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll [bundled] php_filepro.dll filePro functions Read-only access php_ftp.dll FTP functions None php_gd2.dll GD library image functions GD2 php_gettext.dll Gettext functions PHP = 4.2.3 requires libintl-1.dll, iconv.dll [bundled]. php_hyperwave.dll HyperWave functions None php_iconv.dll ICONV characterset conversion Requires: iconv-1.3.dll [bundled], iconv.dll php_ifx.dll Informix functions Requires: Informix libraries php_iisfunc.dll IIS management functions None php_imap.dll IMAP POP3 and NNTP functions None php_ingres.dll Ingres functions Requires: Ingres libraries php_interbase.dll InterBase functions Requires: gds32.dll [bundled] php_ldap.dll LDAP functions Requires libeay32.dll, ssleay32.dll [bundled] php_mbstring.dll Multi-Byte String functions None php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll php_mhash.dll Mhash functions Requires: libmhash.dll [bundled] php_mime_magic.dll Mimetype functions Requires: magic.mime [bundled] php_ming.dll Ming functions for Flash None php_msql.dll mSQL functions Requires: msql.dll [bundled] php_mssql.dll MSSQL functions Requires: ntwdblib.dll [bundled] php_mysql.dll MySQL functions Requires libmysql.dll [bundled] php_mysqli.dll MySQLi functions Requires libmysql.dll [libmysqli.dll in PHP

Chủ Đề