0

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.

2
  • Check /var/error/httpd/* for a cause to the Internal Error Jan 14, 2014 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. Jan 14, 2014 at 10:04

2 Answers 2

1

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.

2
  • 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>. Jan 15, 2014 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. Jan 15, 2014 at 7:14
1

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! :)

1
  • 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. Jan 15, 2014 at 2:18

Not the answer you're looking for? Browse other questions tagged .