Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-09-2013, 03:16 PM   #1
Bruce Whealton
LQ Newbie
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
Problems getting php to work with Centos Linux and Apache

Hello all,
I have Centos running on a separate machine in my local network. I wanted to learn skills that would help me manage a dedicated hosting account, so I setup dynamic dns services. I haven't gotten to the chapter I am reading in various books that deal with DNS on my Centos machine. It is version 6.3 of Centos.
So, I have available in the directory /home/www, with full path
I have a public_html folder in there but I haven't figured out how to get the root for each domain to serve files from the public_html directory instead of from the directory for that domain. I also probably want to setup username's for each directory, so if I wanted to host, with username fwhost, I would have a folder /home/www/fwhost/
and inside there I'd have public_html and that's where the public area for my site would be. That's how it is on my dedicated server that was setup by a company.
When I browse to I get the index.php file that I put inside /home/www/
When I view the source code, I just see my html without any php generated code. It is just thrown out.
I did install php as root using
yum install php*
when I tried that again, it said everything is installed and up to date. I did a search
yum search php and tried installing various packages and they were reported as already installed.
I don't have php anywhere in the /etc/httpd/conf/httpd.conf file. But I have a call to
Include conf.d/*.conf
and there is a simple short file there which I'll copy below. It seems that the other php modules should be called by the httpd.conf file or by the php.conf file. From what I read, it seems that these files should be added to the httpd.conf file when I run the
yum install php*

Here's a thought... I installed the php files from the Centos desktop. So, when I run yum install php* it reports nothing to install and that might be why nothing gets added to the httpd.conf file. It's just a hunch. Guess I'd need to uninstall and then reinstall php to check that out.
Any other thoughts?

Old 03-09-2013, 05:46 PM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
You might want to reference this & there's a whole set of manuals on that site.
All free to read

I suspect you haven't enabled cgi (ie dynamic code like php) in the httpd.conf.
For safety, cgi scripts are disabled in the install.
This could cause the script to be displayed as a 'page', like html, but the browser doesn't understand php, so it dumps it as text.

Last edited by chrism01; 03-09-2013 at 05:48 PM.


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
[SOLVED] problems with lamp (linux apache mysql php kuser:) Linux - General 2 02-27-2012 03:35 AM
Centos 5.2 running Apache 2 and PHP 4 cannot display info.php codenjanod Linux - Server 2 08-19-2008 02:00 AM
Centos 5, Apache, php, mysql Anauj0101 Linux - Server 5 02-26-2008 10:39 PM
Can't get PHP 5 to work on CentOS 4.2, Apache 2.0.52 tibberous Linux - Server 3 10-27-2007 06:25 AM
problems with the apache & Php server of mandrake linux 9.1 krotaz Linux - Networking 6 11-21-2003 08:24 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:21 PM.

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