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.

The Problem:

This has been going on for quite some time. I only got the installation right once, and after that, it either:

  • PHP pages show the PHP codes (not the current error, but I've experienced this)
  • PHP pages return "Internal Error in Server"

All I really want is to get PHP to connect to Oracle 11g XE via oci8. I had no idea it would be this difficult.

Additionally, looking into the error logs (I'm assuming this is PHP's error logs) located in /var/log/httpd/error_log, reveals the following error:

PHP Fatal Error: Unknown: Failed opening required '/var/www/html/info.php' (include path = '.:/usr/share/pear:/usr/share/php').

I've never encountered this before.

The System:

  • Fedora 19 x86_64
  • Oracle 11g XE
  • Apache 2.4.6
  • PHP 5.5.4

Additional Info:

info.php contains merely the following:

<?php 
phpinfo();
?>

php -i works, although I'm not sure what to look for there.

What I tried:

Plenty. But since I've reformatted the PC, and started over, so here's a break down of what I did:

  • Installed Oracle 11g XE
  • Properly backed up my database into said Oracle
  • Modify .bashrc by adding the following

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME  
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME  
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE  
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe; export ORACLE_HOME  
ORACLE_SID=XE; export ORACLE_SID  
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`; export NLS_LANG  
ORACLE_TERM=xterm; export ORACLE_TERM  
PATH=/usr/sbin:$PATH; export PATH  
PATH=$ORACLE_HOME/bin:$PATH; export PATH  

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH  
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

export CLASSPATH

if [ $USER = "oracle" ]; then  
  if [ $SHELL = "/bin/ksh" ]; then  
    ulimit -p 16384  
    ulimit -n 65536  
  else  
    ulimit -u 16384 -n 65536  
  fi  
fi
  • yum groupinstall "Development Libraries"
  • yum install httpd
  • yum install php

I started apache, configured it to start at boot, was able to get to the Fedora test page, and put a test PHP page in /var/www/html/ directory.

localhost works fine.

localhost/info.php returns "Internal Error in Server".

I have no idea what I'm doing wrong. I haven't even gotten PHP up and running yet, so I'm pretty worried about my ability to get it to connect to Oracle. Any ideas / suggestions? Thanks.

share|improve this question

closed as off-topic by SvW, Ward, Falcon Momot, mdpc, Journeyman Geek Jan 16 at 9:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – SvW, Ward, Journeyman Geek
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Check /var/error/httpd/* for a cause to the Internal Error –  Mathias R. Jessen Jan 14 at 9:52
    
I didn't find any directory under var named error. empty is the closest. If you perhaps meant /var/log/httpd/error_log, the file says: PHP Fatal Error: Unknown: Failed opening required '/var/www/html/info.php' (include path = '.:/usr/share/pear:/usr/share/php'). This did not happen before. –  zack_falcon Jan 14 at 10:04

2 Answers 2

up vote 1 down vote accepted

Check permissions on:

/var/www/html/info.php

I recall having a similar error when the user that was running the apache process didn't have the right permissions for this file.

It's not a good thing to to but you could note down the current permissions of info.php, chmod 777 /var/www/html/info.php and see if it works. If so then that's the problem and try and sort out the issue.

Also check as per @GeoSword instructions of you are getting the php code displayed instead of html as this means that the php configuration in apache is not correct.

share|improve this answer
    
This did the trick, though for some reason after doing chmod 777 info.php, said file won't turn up anymore in ls -l. The properties are there, but the filename isn't. It is visible in Dolphin, however. It's listed as -rwxrwxrwx- 1 root root <date> <nothing>. –  zack_falcon Jan 15 at 2:13
    
This is another issue. In any case remember that chmod 777 info.php is not a good thing! This was just to test and assess that permissions on the file were wrong. What you have to do now is check under what user and group the webserver is running and make info.php rwx for that user/group. –  Fabrizio Mazzoni Jan 15 at 7:14

Sounds like there's a number of things going on here.

The pages that showed the php code instead of the result of it is probably because the php handler wasn't properly defined in the apache configuration. Redhat installs usually take care of this sort of thing. However something like this is needed somehwhere in your apache configuration to process php files

LoadModule php5_module    modules/libphp5.so
AddHandler application/x-httpd-php .php .php5 .phtml
AddHandler application/x-httpd-php-source .phps

The fatal error you're getting is probably down to the error you are seeing in /var/log/httpd/error_log.

It looks like /var/www/html/info.php doesn't exist and your php program really wants it. Im sure I dont need to tell you what to do with that! :)

share|improve this answer
    
The pages that show up as PHP code only happened during my last two attempts to get this working - when I tried to compile PHP as a script (to try and get OCI8 working). Downloading apache and PHP / PHP-devel seems to do the trick, but leaves me lost on how to implement OCI8. –  zack_falcon Jan 15 at 2:18

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