Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have installed Centos 5.x, Apache 2.2, PHP 5.3 and MySQL 5.5. I also installed phpMyAdmin. I am able to access phpMyAdmin through the browser without any issues. However, when I create a simple index.php with phpinfo() function in the default directory, that page is served without php parsing.

As we all know, phpMyAdmin is a php application. This is working fine from the same server but not the simple php page from the doc root directory ??!!!. Of course, I tried moving this page into phpMyAdmin folder and tried accessing it, but no success.

Please note that I updated httpd.conf file with appropriate directives based on the php installation guide.Following directives were added to httpd.conf.

AddTyoe application/x-httpd-php 
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so 
<FilesMatch "\.php$"> 
    SetHandler application/x-httpd-php 
</FilesMatch>

File locations are:

  • docroot - /var/www/html
  • phpMyAdmin folder - /var/www/html/phpMyAdmin

File privileges are:

[root@linuxdev1 html]# ls -Z 
-rwxr-xr-x root root index.php 
drwxr-xr-x root root phpMyAdmin 
-rw-r--r-- root root phpMyAdmin-3.4.3.2-english.tar.gz 
drwxr-xr-x root root test1

Any help is appreciated.

share|improve this question
    
Please show us the "appropriate directives" of both directories. –  Matteo Aug 31 '12 at 5:10
    
And the permissions and SELinux properties. ls -Z –  nojak Aug 31 '12 at 5:42
    
Following directives were added to httpd.conf AddTyoe application/x-httpd-php LoadModule php5_module /usr/lib/httpd/modules/libphp5.so <FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch> –  Ram Aug 31 '12 at 6:06
    
I am not sure where to look for SELinux properties –  Ram Aug 31 '12 at 6:07
    
Run ls -Z in the directories and it will display the SELinux properties for the files and folders as well as permissions and ownership. –  nojak Aug 31 '12 at 6:19
show 2 more comments

1 Answer

up vote 3 down vote accepted

I'll guess that you used short tags <? ... ?> in your script and that the php.ini directive short_open_tag is disabled (0).

Change your tags to <?php ... ?>

share|improve this answer
    
You were right on target. When I used the long tags it worked. Thanks. –  Ram Aug 31 '12 at 9:38
    
+1 ... Because you deserve it! –  KarmicDice Sep 3 '12 at 11:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.