LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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



Reply
 
Search this Thread
Old 09-16-2004, 10:35 AM   #1
ldp
Member
 
Registered: Apr 2004
Location: Belgium Antwerpen
Distribution: slackware - knoppix
Posts: 141

Rep: Reputation: 18
php projects: define each class in a seperate file?


Hi,
I'm new to php but want to start a little project to learn more about it.
I remember that in java, I was supposed to define each class in a seperate file and then include those files in the program when needed.
Is there a similar type of convention for php classess?

I'm using php5 with mysql 4.1.4a.gamma and apache2

I suppose that I have to change the include_path directive in the php.ini config file. Problem is that whenever I change that directive, php seems to ignore this.
It might be that I am changing the wrong php.ini file?

root@lieven:/usr/local/php5/lib/php# find / -name php.ini
/etc/php4/apache/php.ini
/usr/local/lib/php.ini
/usr/local/src/php-4.3.7/pear/tests/php.ini
/usr/local/src/php-5.0.1/pear/tests/php.ini
/usr/share/doc/php4/examples/php.ini

=> thus I tought that I had to change the "/usr/local/lib/php.ini" file:
(The goal is that all files in the subdirectories from "/usr/local/apache2/htdocs/magic/" can be used with the include statement.
...
safe_mode_include_dir = ".:/php/includes:/usr/local/apache2/htdocs:/usr/local/apache2/htdocs/magic/class"
...
#paths and directories
include_path = ".:/php/includes:/usr/local/apache2/htdocs:/usr/local/apache2/htdocs/magic/class"
...

but that didn't help even after restarting the apache server.

And in "http://lieven.isa-geek.net:8123/php/system.php" it's not clear to me which php.ini file is used by apache/php

thanks,
Lieven
 
Old 09-16-2004, 03:21 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
From that :
Configuration File (php.ini) Path : /usr/local/php5/lib

Look at /usr/local/php5/lib if there is no php.ini around, if not you have to copy one into it.
 
Old 09-16-2004, 04:57 PM   #3
ldp
Member
 
Registered: Apr 2004
Location: Belgium Antwerpen
Distribution: slackware - knoppix
Posts: 141

Original Poster
Rep: Reputation: 18
Thanks, that solved it indeed. There was no php.ini yet there so I copied the php.ini.recommended to it and altered that file's "include_path" directive.
Now at least, there is no error anymore.
Do you have any idea if it's commonly used to create each class in a seperate file with php? I remember it was done like that at school with java.

regards,
Lieven
 
Old 09-16-2004, 05:43 PM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
That depends, for my part I group little classes in a same file while I put bigger on separate files. But sometimes I let small class in a separate file too because it will grow up as I add methods step by step in a new class.
 
Old 09-16-2004, 06:00 PM   #5
ldp
Member
 
Registered: Apr 2004
Location: Belgium Antwerpen
Distribution: slackware - knoppix
Posts: 141

Original Poster
Rep: Reputation: 18
ok, I'll think I'll do this like I'm used to.
the typing conventions will be much like c or c++ I assume except that you don't give your variables a fixed type or don't define the return value to be of a certain type. Can be confusing from time to time but that's beyond the scope of this thread I think.
thanks for the reply.

Lieven
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to seperate an audio track from a video file? anindyanuri Linux - Software 2 09-16-2005 01:02 PM
Trying to log MS exploits on apache to seperate file not working! jon_k Linux - Software 2 03-19-2005 10:54 AM
PHP: how to use a method from a class in the same class ldp Programming 5 09-17-2004 10:52 AM
how to define variables in the c file of kernel riquelme Programming 2 05-16-2004 08:42 PM
define file as a directory? canon Linux - General 4 03-19-2003 03:22 PM


All times are GMT -5. The time now is 09:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration