Welcome to WebmasterWorld Guest from 54.198.118.102

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Another Can't Parse PHP In html

Sorry for the newbie question

     
3:09 pm on Aug 15, 2007 (gmt 0)

Full Member

10+ Year Member

joined:July 24, 2002
posts:291
votes: 0


On my old server, I had it all figured out, but with a new server, my old commands don't work. Basically, as I said, newbie question, but I want to be able to use .html extensions with php parsed on those pages. If it helps, here is my hosts phpinfo file:

Build Date May 15 2007 12:13:56
Configure Command './configure' '--prefix=/usr/local/' '--with-apxs=/etc/httpd/bin/apxs' '--disable-cgi' '--enable-versioning' '--enable-pic' '--disable-posix-threads' '--enable-memory-limit' '--with-pear=/usr/local/lib/php' '--with-openssl=/usr/local/ssl' '--disable-debug' '--enable-magic-quotes' '--disable-rpath' '--with-bz2=/usr' '--with-zlib' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-exif' '--with-curl=/usr' '--enable-dba' '--with-gdbm=/usr' '--with-flatfile' '--with-inifile' '--enable-dbase' '--with-gd' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr/local' '--with-freetype-dir=/usr' '--with-gettext=/usr' '--with-gmp' '--with-imap=/usr/local' '--with-imap-ssl=/usr/local/ssl' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt=/usr' '--with-mhash=/usr' '--with-unixODBC=/usr/local/unixODBC' '--with-mysql=/usr/local/mysql' '--enable-sockets' '--with-regex=system' '--enable-wddx' '--with-expat-dir=/usr' '--enable-xslt' '--with-xslt-sablot=/usr' '--enable-inline-optimization' '--with-pspell=/usr/local' '--with-dom=/usr' '--with-zlib-dir=/usr'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/Zend/etc/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety disabled
Registered PHP Streams php, http, ftp, https, ftps, compress.bzip2, compress.zlibp

Thanks for any help!

4:06 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 0


You have to change your server configuration. Go into your httpd.conf or .htaccess and change this line (or something close to it):

addtype application/x-httpd-php .php

to parse .html files like this:


addtype application/x-httpd-php .php .html

Once you do that restart your server and you should be good. :)

4:21 pm on Aug 15, 2007 (gmt 0)

Full Member

10+ Year Member

joined:July 24, 2002
posts:291
votes: 0


Makes sense, except I don't have control over the server. How do I get them to restart?
4:26 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:July 12, 2007
posts:766
votes: 0


If you are using .htaccess then they dont need to restart, as this file is read by the server at each request.
If you dont have access to the server config files then put the line of code above in an htaccess file.
4:26 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 0


You could contact them, however, try it within your .htaccess file first; that is, if your hosting company allows .htaccess. If they don't, you are going to have to contact them and get them to change it for you.
4:34 pm on Aug 15, 2007 (gmt 0)

Full Member

10+ Year Member

joined:July 24, 2002
posts:291
votes: 0


Tried it, and it still shows from an earlier test, won't refresh...Need to delete cookies and temp files?
4:38 pm on Aug 15, 2007 (gmt 0)

Full Member

10+ Year Member

joined:July 24, 2002
posts:291
votes: 0


Made a new page, this is the error:

test.php A green apple
Warning: main(vars.php) [function.main]: failed to open stream: No such file or directory in /home/mysite/testingphp1.html on line 23

Warning: main(vars.php) [function.main]: failed to open stream: No such file or directory in /home/mysite/testingphp1.html on line 23

Warning: main() [function.include]: Failed opening 'vars.php' for inclusion (include_path='./:/usr/local/lib/php') in /home/mysite/testingphp1.html on line 23
A green apple

Does the line need to be at the very top of the file, it's down a couple lines.

4:40 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:July 12, 2007
posts:766
votes: 0


If you are using htaccess then this file is requsted internally by the server for each request made. There is no cache on the server.

Your browser is a different matter, so try removing all cookies, sessions, history anything else that you can easily get rid of then try again. As once the htaccess is uploaded it will either break the server and give you a nice 500 error or you it will work.

This is from one of my htaccess files, so defiantly works.
AddType application/x-httpd-php .html

If you want to test if the htaccess is working then put a line of junk in and if that doesnt break the server then it is not working :)
(Just dont start the line of junk with #)

4:41 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 0


>> Made a new page, this is the error:

From this information is seems that php is properly being parsed for that file now, its just that you have errors in your code. Check your code and try again or try something simple:


phpinfo();

[edited by: eelixduppy at 4:42 pm (utc) on Aug. 15, 2007]

4:42 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:July 12, 2007
posts:766
votes: 0


I type to slowly...

You are getting PHP warnings so PHP is working for .html.
The problem is not with PHP its within the code.

4:42 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:July 12, 2007
posts:766
votes: 0


Beaten again :(
4:58 pm on Aug 15, 2007 (gmt 0)

Full Member

10+ Year Member

joined:July 24, 2002
posts:291
votes: 0


phpinfo();

returned

phpinfo();

That what it's supposed to do?

And the .htaccess works, i've got it redirecting a couple pages.

5:04 pm on Aug 15, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 0



phpinfo();

returned

phpinfo();

That what it's supposed to do?

Well, did you surround it with the php tags <?php and?>

And it just gives you information about php. ;)

5:08 pm on Aug 15, 2007 (gmt 0)

Full Member

10+ Year Member

joined:July 24, 2002
posts:291
votes: 0


I'm an idiot. No, I didn't, but once I did, it works. I think i've been staring at this too long with not enough to drink ;)

Works now, so i'll just go back to my code and fix it.

Thanks for the help all!

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members