LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problems getting php to work with Centos Linux and Apache (https://www.linuxquestions.org/questions/linux-newbie-8/problems-getting-php-to-work-with-centos-linux-and-apache-4175453432/)

Bruce Whealton 03-09-2013 03:16 PM

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 fwwebdev.dnsdynamic.com available in the directory /home/www, with full path
/home/www/fwwebdev.dnsdynamic.com/
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 futurewavehosting.com, 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 http://fwwebdev.dnsdynamic.com I get the index.php file that I put inside /home/www/fwwebdev.dnsdynamic.com/
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?

Thanks,
Bruce

chrism01 03-09-2013 05:46 PM

You might want to reference this http://www.linuxtopia.org/online_boo..._6_deployment/ & 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.
HTH


All times are GMT -5. The time now is 08:51 AM.