PHP isnt working, but i dont know why. I have installed it.
I checked modules in httpd.conf and php5 was there.
# cat `rpm -ql apache2-mod_php5|grep conf`
AddHandler application/x-httpd-php .php4
AddHandler application/x-httpd-php .php5
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .php4s
AddHandler application/x-httpd-php-source .php5s
AddHandler application/x-httpd-php-source .phps
but it still is not working
this is my /srv/www/htdocs/index.php
# cat index.php
but http://localhost only shows “Apache”, but not “Works”…
then I saw source of page and there was this :
so, in spite of it is index.php, server perceives it as a html file
sorry for my english, i hope you understand anything
and thanks in advance
replace <? with <?php
<? is by default disabled
1st thing to do:
Try this, if not working…then we will proceed to next step.
NOTE: Apache service is running?
EDIT: microchip8 won.
I replaced it and it worked
Thank you so much for helping…
and one more question
how can I enable, to start php script with <? this?
yes apache is running, and I restarted It many times. I was a little nervous : ))
in /etc/php5/apache2 and /etc/php5/cli config files - usually php.ini
Keep in mind that using short php tags (<?) is not recommended due to portability reasons
Set short_open_tag = Off to short_open_tag = On
-----BEGIN PGP SIGNED MESSAGE-----
‘<?’ should be ‘<?php’.
shako sk8 wrote:
> hello everybody.
> PHP isnt working, but i dont know why. I have installed it.
> I checked modules in httpd.conf and php5 was there.
> PHP code:
> # cat
rpm -ql apache2-mod_php5|grep conf
> <IfModule mod_php5.c>
> AddHandler application/x-httpd-php .php4
> AddHandler application/x-httpd-php .php5
> AddHandler application/x-httpd-php .php
> AddHandler application/x-httpd-php-source .php4s
> AddHandler application/x-httpd-php-source .php5s
> AddHandler application/x-httpd-php-source .phps
> DirectoryIndex index.php4
> DirectoryIndex index.php5
> DirectoryIndex index.php
> but it still is not working
> this is my /srv/www/htdocs/index.php
> PHP code:
> # cat index.php
> print “Works”;
> but http://localhost only shows “Apache”, but not “Works”…
> sorry for my english
> and thanks in advance
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
I used to start php with short tags, but I think its time to grow out of that habit.
Thank you again!
Definitely. Always use long tags no matter if you’re writing you own local site in php or a big public (commercial) site