LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Help installing PHP 5 with other modules (https://www.linuxquestions.org/questions/slackware-14/help-installing-php-5-with-other-modules-602840/)

Ramonvel 11-27-2007 06:23 PM

Help installing PHP 5 with other modules
 
Hi Guys,

I have Slackware 12 on this machine with recompiled httpd-2.2.4. I had installed PHP 5.2.5, but everytime I go to index.php, it displays the code instead of the page.

I need to know if there are any dependencies or something else missing. In RedHat there is a command :" rpm -qa | grep php ", but I don't know how to do it here.

In addition, I need the following requirements:

# PHP 5
# PHP PEAR 5 including DB, Mail and Mail_Mime
# PECL FileInfo
# PHP mbstring - for improved UTF-8 sorting support (optional)
# PHP MySQL 5

All you help to resolve this problem is greatly appreciated. In advanced, Thanks

BCarey 11-27-2007 06:28 PM

Did you add/uncomment "Include /etc/httpd/mod_php.conf" in your httpd.conf?

Brian

Ramonvel 11-27-2007 06:51 PM

HI Brian,

Thanks for your quick response. I looked under httpd.conf. I added

"LoadModule php5_module modules/libphp5.so"
and
modified the index.html line and add index.php to the list.

Besides the above, there is no other php word on the file.

gilead 11-27-2007 06:58 PM

In my httpd.conf I have the following PHP related lines:
Code:

LoadModule php5_module        modules/libphp5.so
DirectoryIndex index.html index.html.var index.php
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

Hope that helps.

BCarey 11-27-2007 07:03 PM

You should have a mod_php.conf file in /etc/httpd. This file will take care of loading the module and create the application types. The "Include" line I gave you will source that file so you don't need to add all that other stuff into your httpd.conf.

Brian

Ramonvel 11-27-2007 08:03 PM

PHP 5 Installation with Modules
 
Hi Guys,

Brian, I did it both way. I added all those modules on httpd.conf and disabled those and added "Include /etc/httpd/mod_php.conf". Unfortunelly, it didn't work either.

Everytime I click on the index.php, now, it try to download the file instead of opening the page.

Any other recommendation, please.

Note: How do I know if the following are installed?

# PHP PEAR 5 including DB, Mail and Mail_Mime
# PECL FileInfo
# PHP mbstring - for improved UTF-8 sorting support (optional)
# PHP MySQL 5

BCarey 11-27-2007 08:12 PM

Did you restart apache after modifying the files?

Brian

Ramonvel 11-27-2007 08:28 PM

Help PHP5 installation with modules
 
Yes I did. I even went further than that. I restarted the server.

tuxrules 11-27-2007 10:25 PM

I have the following line in addition to what gilead mentioned.

Code:

AddHandler php5-script php

Ramonvel 11-27-2007 10:53 PM

PHP5 problems
 
Hi Tux,

Thanks for your help. Yes, I tried that as well, but no luck. Any other recommendation.

Thanks,

agentc0re 11-27-2007 11:33 PM

This is what i had to do to make it work.

At the every end of my httpd.conf file i had a line
Code:

#Include /etc/httpd/mod_php.conf
I uncommented it.

went to my mod_php.conf file and edited
Code:

LoadModule php5_module lib/httpd/modules/libphp5.so
To be
Code:

LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
After that i test out php by doing the following
Code:

cd /srv/httpd/htdocs
vim test.php
< ?php phpinfo() ?>
:wq
apachectl restart

Go to a web browser, yourserver-name/test.php
and you should see a bunch of php info.

Still doesn't work? One other thing i think i remember having to add was MultiViews to my document root options.
Code:

<Directory "/srv/httpd/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks MultiViews

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #  Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>


Alien_Hominid 11-28-2007 01:22 AM

Everything should be set as agentc0re said except MultiViews option is not necessary:
Quote:

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match (??? - what's the best match foo.a or foo.b?) to the client's requirements.

agentc0re 11-28-2007 07:23 AM

Quote:

Originally Posted by Alien_Hominid (Post 2973038)
Everything should be set as agentc0re said except MultiViews option is not necessary:

Heh, i meant to come back and say it wasn't necessary. I think i set that because i was having trouble in the beginning and i was looking at my slack 11 setup and in my conf file on that box, it's in there by default. when in fact it all ended up being a problem with the mod_php.conf file.

BCarey 11-28-2007 04:17 PM

You should not need to edit the mod_php.conf file to add "/usr/" before the module pathname, as you should have a line in your httpd.conf 'ServerRoot "/usr"' which tells apache where to look. You do not need the AddHandler line either.

Are you sure the index.php file contains valid php and that the opening and closing tags are correct? For example, there is a syntax error in agentc0re's test.php file, namely the space between < and ?php, so it will not run properly as written.

Brian

BCarey 11-28-2007 04:27 PM

Quote:

Originally Posted by Ramonvel (Post 2972776)
Note: How do I know if the following are installed?

# PHP PEAR 5 including DB, Mail and Mail_Mime
# PECL FileInfo
# PHP mbstring - for improved UTF-8 sorting support (optional)
# PHP MySQL 5

If you use the test script agentc0re suggested (without the space between '<' and '?php') you will see whether or not these options are installed. If you used the Slackware packages, you _should_ be set to go. BTW, I believe that PEAR is standard in PHP now, and will be there unless specifically _excluded_.

Brian


All times are GMT -5. The time now is 04:46 PM.