Results 1 to 4 of 4
Hello,
I have configured virtual host file on apache and when running php files in the browser I get php code...
Here is my vhost configuration:
Code:
<VirtualHost *:80>
ServerAdmin ...
- 01-24-2012 #1Just Joined!
- Join Date
- Jan 2012
- Posts
- 12
Apache displays php code
Hello,
I have configured virtual host file on apache and when running php files in the browser I get php code...
Here is my vhost configuration:
Could you please suggest what else I need to include or what to check?Code:<VirtualHost *:80> ServerAdmin sample(at)sample.com ServerName sample.sample.com DocumentRoot /var/www/html/test ErrorLog /var/log/httpd/test_error.log CustomLog /var/log/httpd/test_access.log combined AddType application/x-httpd-php .php .html .htm </VirtualHost>
Regards
- 01-25-2012 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Is PHP installed? How did you install it? It should be installed via yum (versus manually) along with Apache, for a painless Apache+PHP webserver.
Normally, you should be able to do:
andCode:yum install httpd php
and be off and running. Maybe you can just back up any modified apache/php config files and reinstall the packages, to be on the safe side. To see if any packages have been modified, you can run:Code:service httpd restart
After confirming that, I'd start with a PHP file in the DocumentRoot first (e.g. /var/www/html/phpinfo.php), to make sure you can get any PHP working at all.Code:rpm -qV httpd rpm -qV php
Also you might want to temporarily enable error output in the PHP.ini file (/etc/php.ini, probably).
- 01-25-2012 #3Just Joined!
- Join Date
- Jan 2012
- Posts
- 12
Hi,
I have solved my problem. It's kind of my fault.
First of all I didn't have this record "LoadModule php5_module modules/libphp5.so" in my http.conf file.
I was thinking that I don't need it because I do have file "php.conf" where mentioned record exists. But file "php.conf" was not loaded by apache.
The problem was that in the file "http.conf", I have specified that config file for virtual host is "Include vhost.conf" and I commented "Include conf.d/*.conf" so because of that "php.conf" was not loaded.
Thanks and sorry for taking your time...
- 01-25-2012 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Glad you got it sorted. I did not have to manually do that stuff on my box, though. The packages are already configured to work, which is why I asked. For example, the file:
/etc/httpd/conf.d/php.conf
belongs to the php package, and loads the module like you had to do.
Then in /etc/httpd/conf/httpd.conf, there is this bit:
which calls the above php.conf file, which loads the module.Code:# # Load config files from the config directory "/etc/httpd/conf.d". # Include conf.d/*.conf
anyway, important thing is, you got it working!


Reply With Quote
