Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-24-2008, 05:58 AM
|
#1
|
|
Member
Registered: Jun 2005
Location: Aachen, Germany
Distribution: Debian
Posts: 74
Rep:
|
PHP-style library for C/C++?
I've been programming web applications in PHP for a very long time now, but whenever I start a new project I'm wondering if it wouldn't be better and easier to use C++. I guess that some people here will agree with me, and many probably won't, but let's just ignore that
So the only reason I'm still using PHP is time. I have to put up with the language but I'm rewarded with a library that does very many things I'd have to do myself in C++. It's not just the HTTP-related stuff like cookies and headers, file uploads and all that, it's also the other parts of the library, such as file_get_contents() and the like.
I think there's really nothing wrong with having a way to request a local or HTTP file in one single line, but in C++ that just does not seem to be possible, not with the libraries I've seen.
So I'm thinking about finally taking this step and switching to C++, and I'm even ready to write my own little library that can simplify many things for me.
But before I go ahead with this I wanna make sure there really isn't anything useful out there I've overlooked.
So does anyone know about a library like what I've described?
(And, yes, I know about Java Servlets and all that but that just isn't for me  )
TIA
|
|
|
|
03-24-2008, 06:03 AM
|
#2
|
|
Member
Registered: Aug 2007
Location: Sweden
Distribution: OS X, Gentoo, FreeBSD
Posts: 82
Rep:
|
Hmm, are you looking to use C/C++ for the same purpose as PHP, i.e. creating web sites, etc? If so, I wouldn't look at just any programming language, but either a web-specialized one (like PHP), or something with a web framework (like Python + Django, Python + Turbogears, Ruby + Rails, Perl + Catalyst). C++ just isn't very optimal, at all, for that purpose.
|
|
|
|
03-24-2008, 06:17 AM
|
#3
|
|
Member
Registered: Jun 2005
Location: Aachen, Germany
Distribution: Debian
Posts: 74
Original Poster
Rep:
|
I know, that's my point. I want to make it optimal
I realize that C++ makes it more complicated in most cases, but I actually want that. I want static typing and all that cause only then can I really control and predict the application's behavior in all situations. And I also like multiple inheritance and stuff like that.
For small scripts with simple purposes I would still use PHP (anything else wouldn't make any sense cause most of what I write has to be able to run on any webserver out there), but what I'm working on mostly is big database backends or CMSs that include database backends. For those things I want all the power C++ can give me, PHP and other scripting languages just aren't nearly enough for that.
Anyway even in those projects I have to do some thins that are not database- but web-related, and for that I need functionality similar to that of PHP.
|
|
|
|
03-24-2008, 12:31 PM
|
#4
|
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
Why not use php as a frontend to a C or C++ library? You can compile shared objects for php in C or C++ and use them from your php scripts. Otherwise, compile your C or C++ program as a server to which your php script may make a socket or other IPC connection.
|
|
|
|
03-24-2008, 01:21 PM
|
#5
|
|
Member
Registered: Jun 2005
Location: Aachen, Germany
Distribution: Debian
Posts: 74
Original Poster
Rep:
|
That with the modules sounds interesting  Do you have any more information on that? Is that "officially supported" by PHP or does it involve some hacking?
The problem is that some of my projects have to run on servers that don't belong to me. For my own server I would probably write a database deamon indepent of HTTP, but I guess the big hosting companies my customers like to use would not allow that  So I have to use something that's either supported by most servers or that can go in the cgi-bin folder...
|
|
|
|
03-24-2008, 06:48 PM
|
#6
|
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
It is “officially supported” in the sense that the majority of php is in extensions (some of which are third-party and some of which come with php). Here is a tutorial.
Some hosting providers allow you to use your own compiled extensions (if you upload them to the libexec directory), but you’ll have to check whether or not yours does as well.
|
|
|
|
03-24-2008, 07:42 PM
|
#7
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally Posted by DeNayGo
I know, that's my point. I want to make it optimal :)
I realize that C++ makes it more complicated in most cases, but I actually want that. I want static typing and all that cause only then can I really control and predict the application's behavior in all situations. And I also like multiple inheritance and stuff like that.
For small scripts with simple purposes I would still use PHP (anything else wouldn't make any sense cause most of what I write has to be able to run on any webserver out there), but what I'm working on mostly is big database backends or CMSs that include database backends. For those things I want all the power C++ can give me, PHP and other scripting languages just aren't nearly enough for that.
Anyway even in those projects I have to do some thins that are not database- but web-related, and for that I need functionality similar to that of PHP.
|
Did you come across witty in your searches?
Cheers,
Tink
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:58 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|