# Activating the CC (C compiler) on my UNIX terminal



## Belaran (Mar 26, 2003)

Hi !

I'm student and i'm going to use C next year and i would like to use "CC C_source.c" but the unix shell tell me :

cc: Command not found.  

How can i fix this ?


----------



## Captain Code (Mar 26, 2003)

Do you have the developer tools installed?


----------



## Belaran (Mar 26, 2003)

yes but i don't want to use them.
In my school i'll be working with the "regular" (= non-MacOS X) Unix and i'll compile with it. I need to use a system as near as possible of the one i'm going to use...
Moreover , i don't exactly konw how to correctly use most of the developer 's tools wich my work far more complicated, because in my school work i'll be working directly with the terminal !

do you know why the CC commands is shut down or absent ? 

thank a lot for your response...


----------



## Captain Code (Mar 26, 2003)

cc is installed with the Developer tools.  It's possible your path isn't set properly in the Terminal.  Try typeing echo $PATH in the terminal and post what your path is.


----------



## Belaran (Mar 26, 2003)

hey ! you're right, i haven't install it on THIS  mac ! I'm installing it right now, i'll tell you if it's working !

I've a another problem : my apache server down and the unix error message is :

[Belaran:~] belaran% apachectl graceful
/usr/sbin/apachectl graceful: httpd not running, trying to start
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/belaran.conf
 Processing config file: /private/etc/httpd/users/error_log
Syntax error on line 1 of /private/etc/httpd/users/error_log:
Invalid command 'Processing', perhaps mis-spelled or defined by a module not included in the server configuration
/usr/sbin/apachectl graceful: httpd could not be started
[Belaran:~] belaran% 

any guess ?


----------



## Belaran (Mar 27, 2003)

That's it , cc is working now !

I'm such a %*£*%*£ !

thank you


----------



## Captain Code (Mar 27, 2003)

I'm not sure about your apache problem.  It sounds like there's a problem with your config file though.  I suggest you start a new thread about it in this forum if you haven't already.


----------



## Darkshadow (Mar 27, 2003)

Err...there shouldn't be an error_log in /etc/httpd/users - that's the problem!  It's trying to go through that as if it's a config file, but it's a log file and so doesn't have the syntax apache is expecting...that gives you the error you're getting.

Delete the error_log from there, and check your httpd.conf file to make sure it's not saving the error_log there for some strange reason.

Oh and BTW, if your school is using the GNU version of cc (gcc), it's almost identical to Apple's cc - it's based on GNU's gcc with some added options for the Obj-C stuff and whatnot.  So pretty much anything you do with it you'll be able to do with the cc you use at school (as long as you're sticking to C and not Obj-C, anyway).


----------



## Belaran (Mar 28, 2003)

Thanks a lot both of you !

About GNu and stuff, you may be found this quite strange but the exploitation system of my school is ... OpenVMS !
 

At some point we're going to use unix , but at for almost two year we only work on VMS (wich is quite a good system by the way)...

I erased the error_log and it's still going wrong !


[Belaran:/etc/httpd/users] belaran% ls
belaran.conf error_log
[Belaran:/etc/httpd/users] belaran% sudo rm error_log 
[Belaran:/etc/httpd/users] belaran% ls
belaran.conf
[Belaran:/etc/httpd/users] belaran% apachectl graceful
/usr/sbin/apachectl graceful: httpd not running, trying to start
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/belaran.conf
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl graceful: httpd could not be started
[Belaran:/etc/httpd/users] belaran% 

Obviously there somekind of authorisation problem. I checked the rights with the bacthmod 1.31 freeware and i got this
owner (belaran): R W 
Groupe (staff) : R
World : R
why is it unable to open it ? Everybody can !!!


----------



## Darkshadow (Mar 28, 2003)

Hmm, try giving the file RW to everyone, maybe that's it - though the conf file for my user has the same exact permissions, so I dunno.

It looks like it's dying on the error_log, though.   At least this time it's looking in the right place 

Try this command in the terminal: *sudo touch /var/log/httpd/error_log*.  That should get rid of that error, and apache may start up after that.


----------



## Belaran (Mar 28, 2003)

STill not doing it !
This is quite a mess ! I can't understand how such a big problem as occurs !

Anyway the error message :

[Belaran:~] belaran% sudo touch /var/log/httpd/error_log
[Belaran:~] belaran% apachectl graceful 
/usr/sbin/apachectl graceful: httpd not running, trying to start
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/belaran.conf
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl graceful: httpd could not be started

still authorizations difficulties !


----------



## lurk (Mar 28, 2003)

What is the result of *ls -la  /private/var/log/httpd*


----------



## Belaran (Mar 28, 2003)

[Belaran:~] belaran% ls -la /private/var/log/httpd
total 184

drwxr-xr-x   4 root  wheel    136 Mar 28 14:35 .
drwxr-xr-x  38 root  wheel   1292 Mar 27 03:15 ..
-rw-r--r--   1 root  wheel  92047 Mar 15 00:18 access_log
-rw-r--r--   1 root  wheel      0 Mar 28 14:35 error_log
[Belaran:~] belaran% 

 Still confusing....


----------



## Darkshadow (Mar 28, 2003)

What happens if you try *apachectl start* rather than *apachectl graceful*?


----------



## Belaran (Mar 29, 2003)

[Belaran:~] belaran% apachectl start
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/belaran.conf
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl start: httpd could not be started

still this "permission denied" ! this is crazy !


----------



## nickn (Mar 29, 2003)

I could be wrong however you appear to be logged in as the user Belaran , most likely in the 'wheel' group, the file is owned by root, you give the owner read/write permissions however you do not give the group read write permissions, I would try :

chmod 664 /private/var/log/httpd/error_log
chmod 664 /var/log/httpd/error_log

One or the other...Keep in mind although I am familar with FreeBSD and *nix in general, I am not familar with mac osx, so I' not sure about the whole /private/ prefix on that first one.

However i do believe that you will need to give permissions to the group as well, I could be wrong, it's early in the morning.


----------



## Belaran (Mar 29, 2003)

Anyway thank you nick, i had already tried to change things with chmod without success, 
i tried your idea :

Belaran:~] belaran% sudochmod 664 /private/var/log/httpd/error_log
sudochmod: Command not found.
[Belaran:~] belaran% sudo chmod 664 /private/var/log/httpd/error_log
Password:
[Belaran:~] belaran% sudo chmod 664 /var/log/httpd/error_log
[Belaran:~] belaran% apachectl start

Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/belaran.conf
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl start: httpd could not be started

but as you can see same thing again !
I'm afraid that we're all missing something here, 'cause none of us understand where is the problem...
It's appear to be a authorisation problem, but no chmod operation seems to be sufficient...


----------



## nickn (Mar 29, 2003)

I know this is highly spoken against..but maybe try sudo apachectl start


----------



## Belaran (Mar 29, 2003)

I forget i had already try this, and , we're going to love it, see what i get :

[Belaran:~] belaran% sudo apachectl start
/usr/sbin/apachectl start: httpd (pid 398) already running
[Belaran:~] belaran% 

already running !!!!! *%*%*'s already running !!!

I dunno how I end up in this mess but i surely  mess it up completly.

... Oh, by the way : i've already tried to re-install the all macos X.2 system ! 

I believe i try to sudo kill the pid but i'm not sure quite i succeeded ...

I'm still begging for your help


----------



## Darkshadow (Mar 29, 2003)

Well, try *sudo apachectl stop*, then do *sudo apachectl start*.  You know, I should have thought of sudo first, the initial apache daemon is usually owned by root.  That could make a big difference with those permission problems.

Hmm, you could try *sudo apachectl restart* rather than a stop/start.  Does the same thing, pretty much.


----------



## Belaran (Mar 29, 2003)

[Belaran:~] belaran% sudo apachectl restart
Password:
/usr/sbin/apachectl restart: httpd restarted

at this point i was enthousiast !

[Belaran:~] belaran% apachectl graceful
/usr/sbin/apachectl graceful: httpd not running, trying to start
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/belaran.conf
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl graceful: httpd could not be started
[Belaran:~] belaran% 

now i want to cry...


----------



## Darkshadow (Mar 29, 2003)

Err, you wouldn't need to do apachectl graceful after the first command, it would get it up and running.  Try doing *ps -auxc* and look for *httpd*.  If you're using the default httpd.conf file, you should see three of them in the output.  That lets you know it's up and running.  If you see that, you don't need to try it again


----------



## Belaran (Mar 30, 2003)

i found  three entry :

www       460   0.0  0.3    15472    632  ??  S     3:34PM   0:00.02 httpd
www       396   0.0  0.3    15988    640  ??  S     3:24PM   0:00.10 httpd
root      394   0.0  0.6    15472   1232  ??  Ss    3:24PM   0:00.22 httpd

HTTPD seems to be running, so normally i should be able to run a .php file no ?


----------



## nickn (Mar 30, 2003)

Do you have php support as well? apache by itself won't do php if i'm not mistaken.


----------



## Belaran (Mar 30, 2003)

In httpd.conf , i "uncommented" those lines:

LoadModule php4_module
LoadModule  hfs_apple_module
AddModule mod_php4.c
AddModule mod_hfs_apple.c

Anyway, i can access to some of my file as there was a webpage ( i can type http://127.0.0.1/~belaran/myfile.html ) but "php page" still aren't working.

I believed that apachectl graceful was a command that simply ask the apache server "are you there ?" and "how are you ?" or DarkShadows seems to imply that it's not the case. Do you know a command that follow my initial idea ?


----------



## Darkshadow (Mar 30, 2003)

No, *apachectl graceful* does (according to apachectl) "a graceful restart by sending a SIGUSR1 or start if not running" 

And since you weren't root, it was trying to start with the permissions your user has, so it wasn't restarting...actually it probably never stopped apache, since you would've needed to be root to do that.

As to why the php pages aren't running...you need to add this into the httpd.conf file as well:

Under <IfModule mod_mime.c>:
AddType application/x-httpd-php .php

After you do that, you'll need to restart apache again (*sudo apachectl restart*)

That let's the server know that .php files are to be run as PHP.


----------



## Belaran (Mar 30, 2003)

Thanks a lot, now i get it through. from the beginning i tried to restart or to start httpd with my user rights and not my "root" rights, so i was denied see access by the system. 
My Apche server is (and always been) working just fine ! ... even with the mess i've been doing try to fix it ! °)

But now i go to case "departure" of my initial problem. all my pages .php are not " reconized " wich basicly means that all the stuff include between "<?php" and "?>" is ignored by all my browser (camino & explorer) !

It's not my apache server and i believe i've done all the proper modifications on my httpd.conf (see previous entry),  my page are all labelled .php, what could going wrong ?


----------



## Darkshadow (Mar 30, 2003)

Err...did you see my last post?  Do you have the AddType line in there as well?


----------



## Belaran (Mar 31, 2003)

Yes i did it to , no problem there....


But i've some news !

It's seems that my explorers can't read any of my file "as localhost" 'cause :

Forbidden
You don't have permission to access /~belaran/CD_Romain/index.html on this server.

------------------------------------------------------------------------
Apache/1.3.27 Server at belaran.local Port 80


Maybe i forgot some configurations but i don't wich one ! I know for a fact that my "Web Sharing" is started and that the only thing i know which could create such a problem ( by being turned off, of course)...


----------

