where to put php extensions

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

where to put php extensions

Post by raghavan20 »

i have fedora core 5 and i have never installed webserver/php in Linux; just used it all these years!

actually i thought of installing apache and php using rpms but i came to see that they are pre-installed.
The httpd is working and php is working as well.


I have a few clarifications now:

1. when i see the httpd.conf file in /etc/httpd/conf/httpd.conf, i cannot see any line that adds module to execute php files eventhough i see the MIME type added


2. I need to load extensions for php like this one
extension=php_domxml.dll

and when i was looking at php.ini i see that there is no extension line mentioned? now my questions are
2.1 where should i create extensions directory in system optimally?
2.2. where can i get the .so files which are extensions for Linux?
2.3. how do I install PEAR from here?


3. My Linux system does not have internet connection so do you think this will be a problem when using PEAR because I am trying to use symfony framework and I doubt symfony framework might try to download packages dynamically?

[EDITED]
3.2. PEAR is not installed so far; the last time I installed in Windows, there was a go-pear file which downloaded the PEAR manager and i then used PEAR manager to download packages but this system does not have internet connection so how do I install package manager?

do you guys also suggest me to directly download the packages instead of going through PEAR manager?


4. since httpd is pre-installed, I do not really know how to start or stop the process? It does not appear to be installed as service because I tried this and it does not work
service start apache


5. how to add apache as service so that is starts up when system is started?


Any help would be deeply appreciated.
Last edited by raghavan20 on Wed Oct 11, 2006 11:16 am, edited 2 times in total.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

FC5 Changed the way extensions are loaded for PHP. Your php.ini file should be in /etc/php.ini. The modules are loaded by way of their own .ini files that are located in /etc/php.d/. the extensions folder is /usr/lib/php/modules/ to the best of my knowledge.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

Everah wrote:FC5 Changed the way extensions are loaded for PHP. Your php.ini file should be in /etc/php.ini. The modules are loaded by way of their own .ini files that are located in /etc/php.d/. the extensions folder is /usr/lib/php/modules/ to the best of my knowledge.
thanks for your reply everah,,,do you advise me to put all the extensions in /usr/lib/php/modules. Can you tell me where can I get other .so files from?

I do not understand the other .ini files in /etc/php.d/. If you dont mind, can you tell where those are used?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

The other ini files are the parts of (what you would usually expect to be the extensions part of) php.ini. So the other ini files look like:

Code: Select all

; Enable mysqli extension module
extension=mysqli.so
These files are read into the php.ini file at runtime and execute the extension enabling. As for getting other extensions, I have just RPM'ed them from various RPM repositories or from the FC repository.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

raghavan20 wrote:
Everah wrote:FC5 Changed the way extensions are loaded for PHP. Your php.ini file should be in /etc/php.ini. The modules are loaded by way of their own .ini files that are located in /etc/php.d/. the extensions folder is /usr/lib/php/modules/ to the best of my knowledge.
thanks for your reply everah,,,do you advise me to put all the extensions in /usr/lib/php/modules. Can you tell me where can I get other .so files from?

I do not understand the other .ini files in /etc/php.d/. If you dont mind, can you tell where those are used?
Your httpd.conf will have the line:

Code: Select all

Include /etc/php.d/*.conf
somewhere (or just php.d/*.conf)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Mine doesn't. But it does have this

Code: Select all

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf
Then, in the /etc/httpd/conf.d directory it has a php.conf file that looks like this

Code: Select all

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php5_module modules/libphp5.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

fyi - that's setup to run all pages via php-cgi.

Change your AddType line to:

Code: Select all

AddType application/x-httpd-php .php
and then scrap the AddHandler line all together for a more efficient setup :)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Thanks Jenk. I'll look into it. Will I still be able to run PHP from the CLI if I do that?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Yes, the php cli is independant of Apache :)
Post Reply