Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am looking to convert my PHP library code as a PHP extension. The full library is under a namespace. There are many PHP classes I am using under my library.
Is there any tool which convert the PHP code to .so and .dll PHP extension (with the namespace usage) ?
Writing the code in C or CPP is too much of work.
There is no tool that will automagically convert PHP code to a PHP Extension, but tools like Zephir provide a half-way DSL that can easily be converted from straight PHP and then compiled against Zephir to build a PHP extension... and yes, it does work with namespaces
The Zephir docs are pretty good, and give a decent explanation of how to write code for the Zephir DSL, and there are blog posts like marmelab's that show how to convert a PHP (namespaced) class to an extension using Zephir.
Edit
Since posting this answer, I've also discovered PHP-to-Zephir which claims to be able to convert PHP code to the Zephir DSL, although I haven't tested it in any way
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have a large code base I've written in Perl for a web application. Recently, I've decided to use Braintree's payment system, but their Perl library is deprecated. I decided I'd have to write a new set of PHP scripts that duplicated quite a few user functions from my Perl code, which, obviously, is less than ideal. Then I came across PHP::Interface on CPAN and the PECL Perl extension for PHP, both of which promise to allow code from the one language to be interpreted in the other, exposing variables across the language divide, etc. Either would be a huge help, but both appear unmaintained and broken in modern environments. Is there some currently maintained way to either expose my Perl modules to PHP or some PHP functions into Perl?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to read php source code(ZendPHP source code) in Visual Studio. How to do it?
By default Visual Studio doesn't ship with support for PHP. You can add support using an extension or edit the php files as part of a WebApplication project (in which case you will receive very basic editing support).
There are a bunch of extensions for Visual Studio which support PHP as a supported language in Visual Studio. I personally used the ones from DevSense a long, long time ago.
If you don't want to use an extension (for whatever reason) you can create an empty Web Application project and manually add your php files to it and set them to "content". That way the php files will be copied when you publish the application. You can remove any items that are .NET specific such as a default web page and the app.config.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Please let me know if you know a word file generator for php on Linux server.
I have a template word file and I want to generate a word file according to the template using php from my linux webserver.
As far as I can find on the web, all of these php libraries need Microsoft Word application to install on the server. I need plug-in which doesn't need to install word in the webserver since mine is linux. Please guide me.
Any work around or name of the plug-in would help me. Thanks in advance.
As mentioned in comment you can use You can use https://github.com/PHPOffice/PHPWord It's a PHP library that can create DOCX along with some formatting.
If you are looking for a similar solution you can also visit this link
http://webcheatsheet.com/php/create_word_excel_csv_files_with_php.php
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
We have a PHP web app running on a customer's machine. For an update, we have a bit of code in C that we'd like to include as a native opaque library along with the PHP web app.
How does one go about calling a C/C++ lib. function from PHP?
It cannot be assumed that the PHP app, called by the web server, has any sort of permission to call an exec(), eval(), or system() type of function to execute a C wrapper driver which in turn uses the C/C++ library, so it would need to be a direct C library use from within the PHP code.
Take a look at some of the Zend tutorials on Extension writing, this one in particular "Wrapping C++ Classes in a PHP Extension"
The answer by St. John Johnson is correct. But you can now also us the php-cpp library. It offers a much easier bridge between PHP and C++. See http://www.php-cpp.com for more information.
Another option is to have the C code as a daemon, always running, and the php script connect to it throught unix domain sockets or some existing library to exchange data.
More info here
You can compile your code and use system, shell_exec or passthru functions to handle the output. Most web hosts allow you to compile c++ code, just ssh to your server, upload the code and compile it.
You can use ZEND to plug your C code into PHP.
http://php.net/manual/en/internals2.ze1.zendapi.php
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I've got PHP installed from the repos on my Ubuntu 9.10 local machine. Where can I find the source code to the PDO classes?
As of PHP 5.1, PDO is part of the PHP core so it should be somewhere in there. My educated guess is
/ext/pdo
Before 5.1, it used to be a PECL package that is still available here. If you want to browse the source just for curiosity, it might do. If you need the current one, look in the core.
The PHP code can be found on GitHub: https://github.com/php/php-src
And the PDO classes are under /ext/pdo as Pekka 웃 pointed out.
In this way you don't need to download the full code, but read it online.
The PDO version of pgsql should come with the php5-pgsql package.
apt-get source php5-pgsql will grab the source code used by the Ubuntu team to package the module for the repository.
In the source directory you're looking for something like php5-5.2.12.dfsg.1/ext/pdo_pgsql/ the precise path will of course vary depending on the version of php used.