Forum Moderators: mack

Message Too Old, No Replies

CgiCC & httpd.conf

What should I write inside httpd.conf to make apache process my C++ scripts

         

Mareq

12:31 am on Dec 30, 2004 (gmt 0)

10+ Year Member



What should I write into httpd.conf to make apache process my C++ scripts? And what other things should I do to make it run properly? I'm total newby, please help!

coopster

2:33 am on Dec 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, Mareq.

Have you looked into Apache's tutorial on Dynamic Content with CGI [httpd.apache.org]? Also, you may be better served by posting in the Apache Forum [webmasterworld.com] here at WebmasterWorld.

Mareq

2:10 pm on Dec 31, 2004 (gmt 0)

10+ Year Member



Yes, I've already red some of these manuals, but they allways speak about perl and I need C++... Should I compile my script (if yes, then how?), should I install some additional packages, or so and how should I tell Apache to run my C++ script? (And another question is, how should I connect to my PostgreSQL and MySQL databases from C++ script?)

coopster

5:59 pm on Dec 31, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Thread has been picked up over in Apache:

[webmasterworld.com...]

Mareq

7:56 pm on Dec 31, 2004 (gmt 0)

10+ Year Member



Yop, thank you, man :o) I've red that manual once more time and it works! :o))

Please tell me just one another thing. How do I connect and work with PostgreSQL and MySQL databases in my C++ scripts (I know C++ wery well, but only under DOS/Win and I've never worked with database in C)

coopster

9:14 pm on Dec 31, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




I've red that manual once more time and it works!

Nice job. You should post your directive here for future readers so they can learn from your experiences. That's the beauty of a forum -- take some, give some back, my friend ;)


Please tell me just one another thing. How do I connect and work with PostgreSQL and MySQL databases in my C++ scripts

I'm not sure about PostgreSQL, but for MySQL you are probably best off emloying the MySQL C++ API [dev.mysql.com].

Mareq

7:52 pm on Jan 1, 2005 (gmt 0)

10+ Year Member



"That's the beauty of a forum -- take some, give some back, my friend ;)"

Of course I do, but I needed to make it run all to become little bit familiar with this topic :o) So, here it is:

I use Debian Linux, so I've downloaded necessary packages from [debian.org...] (cgicc and libc with all depending packages) and because my server has no direct connection to internet I used

dpkg -i here_comes_all_packages_being_installed_separated_by_space

to install them. On my old Debian Woody I also had to upgrade gcc (there was some strange error during compilation fo cgicc but with new compiler it works well)

To make Apache serve executables as CGI, I should add this line into my httpd.conf:

ScriptAlias /cpp/ /home/apache/cpp/

So I place my compiled (the only howto about compilation of my cpp scripts I found at [yolinux.com...] ) scripts into /home/apache/cpp/ directory and view them at [192.168.1.100...]

Another problem was using PostgreSQL (I have no time to play also with MySQL and I use primarily Postgres, so I gived up any attempts to install MySQL) in my C++ scripts. Once again I used dpkg to install libdbi and libpgsql with all dependant packages. Detailed howto about compiling scripts, which use Postgres I found at [pgsqld.active-venture.com...] , but they forgotten mention one thing. Script was successfuly compiled, but when run, it presented me with strange error about missing libpq.so.3. So I've also had to add library path (/usr/local/pgsql/lib - the one, which can be determined by "pg_config --libdir" command) into my /etc/ld.so.conf and then run ldconfig command, which takes no parameters, probably only -v for long listing of libraries.

After all this done, finally it works as I need...

coopster

12:04 am on Jan 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Thanks for sharing, Mareq. All the best to you and yours this New Year :)