Click to See Complete Forum and Search --> : My browser displays my php code instead of..


Anatoly7
09-02-2002, 07:37 AM
Hi guys!

I'm trying to get started with php and when I try to run different "Hello World" stories I just see my code in the browser.

So, my browser displays my php code instead of displaying what I mean it to display with that code. For example if I have the code- <?php echo $_SERVER["HTTP_USER_AGENT"]; ?>-
in my .php file, then it is exactly what my browser displays.

I use RedHat Linux 7.3 and I chose to install both Apache and PHP during the installation of the whole system.

Anybody can help?

Regards,
Anatoly

chingwaah
09-02-2002, 07:56 AM
This means your webserver server did not understand your PHP code.

Solution:

Ensure your PHP is installed correctly. In NT, just go to IIS manager and add the PHP.EXE to the application under "Home Directory" tab.

yelvington
09-02-2002, 10:17 AM
Since he's not using NT and IIS, that's not going to help.

Anatoly, either PHP isn't installed on your system, or your httpd.conf file does not contain the directives necessary to activate it, or you installed PHP after the httpd server was already running and you have not restarted it.

Start by checking with RPM to make sure that the PHP module has been installed.

If it has been, look at httpd.conf to ensure that it contains lines like this:

LoadModule php4_module /usr/lib/apache/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps

These may be either in httpd.conf, or an included file such as addon-modules/php.conf.

If they exist, do this (as root)

service httpd restart