centos 5: config apache to execute php scripts/pages
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
centos 5: config apache to execute php scripts/pages
most of my googling odysseies lead me to articles which talk about compiling apache & php from the source as this is touted to be more flexible. But the problem we have is this...we already have an apache 2 web server running. Now how do we serve php pages of it...
PS: i believe we even have php installed...
Last edited by deostroll; 12-09-2009 at 03:03 AM.
Reason: added more info.
$ rpm -qi php
The php package contains the module which adds support for the PHP
language to Apache HTTP Server.
Name : php Relocations: (not relocatable)
Version : 5.1.6 Vendor: CentOS
Release : 23.2.el5_3 Build Date: Tue 07 Apr 2009 05:34:02 PM IST
Install Date: Mon 25 May 2009 06:53:19 PM IST Build Host: builder10.centos.org
Group : Development/Languages Source RPM: php-5.1.6-23.2.el5_3.src.rpm
Size : 3017223 License: The PHP License v3.01
Signature : DSA/SHA1, Tue 07 Apr 2009 05:50:04 PM IST, Key ID a8a447dce8562897
URL : http://www.php.net/
Summary : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.
The php package contains the module which adds support for the PHP
language to Apache HTTP Server.
Code:
$ cat /etc/httpd/conf.d/php.conf
#
# 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
Yet I am not getting the php page served...don't know if the php code is incorrect either...pasting the code here for reference:
it still doesn't work...4got to mention wher i've kept my php file...
in /var/www/html/test folder I've created a page called index.php with the above code.
[Wed Dec 09 04:57:09 2009] [error] [client ::1] PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Dec 09 04:57:09 2009] [error] [client ::1] PHP Warning: Unknown: Failed opening '/var/www/html/test/index.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
[Wed Dec 09 04:58:08 2009] [error] an unknown filter was not added: PHP
Don't understand those permissions I've to set tho. Are there any articles that can come in handy?
Isn't there a more direct way? I mean I am looking at directly creating php files and expecting them to get deployed...straight. So those files should have the correct permissions...I don't want to create a file and then change its permission always...OR, is this how its done always?!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.