/    Sign up×
Community /Pin to ProfileBookmark

PHP code showing up in html

I was following the PHP manual and it said “…jump in and out of html with php…”

Anyway, PHP is showing up in my html file when viewed in the browser

I am using a VPS with GoDaddy and a lot of stuff is not installed (go figure)

I tried to add this to the httpd.conf file but after I added it, every time I would try to access any of my websites they would immediately download… what does that mean?

AddType application/x-httpd-php .htm .html

That’s the line of code I tried to add from an article I found about php parsing

.php files execute fine, when I submit forms, the databases are filled

I don’t know what this means that <?php and anything inside ?> shows on html

Any help would be appreciated

Thanks

to post a comment
PHP

16 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 08.2014 — Well, the first question has to be: does your web host installation have PHP? (Have to ask, just in case.)

Secondly, make sure you changed the correct httpd.conf file, plus you'll probably have to restart Apache after you change it.
Copy linkTweet thisAlerts:
@GreenAce92authorDec 08.2014 — Yeah I don't understand this, I finally figured out how to fully access my VPS with GoDaddy by using SSH PuTTY but surprise, I get the same result of downloading pages.

What does that mean? I placed the AddType application/x-httpd-php .php

I think PHP is installed, I mean that sounds stupid but if I can write to a database using a form tied to a .php file doesn't that imply that php is working?

yeah so every, EVERY, page I access or website that is attached to this server / this httpd.conf file, automatically downloads, doesn't even display

What does that mean?
Copy linkTweet thisAlerts:
@GreenAce92authorDec 08.2014 — I think this is my next move

I just have to figure out how to go about it

A convenient module install setting or button or command line, but in what directory...

LoadModule php5_module "c:/php/php5apache.dll"
Copy linkTweet thisAlerts:
@GreenAce92authorDec 08.2014 — Hmm... this is probably not going to end well

I've got one step out of three

LoadModule php5_module "c:/php/php5apache2.dll"

AddType application/x-httpd-php .php

PHPIniDir "c:/php"

I'm going to install filezilla, I downloaded a version of php I think one that matches the current one I'm using, at the very least it has the php5apache2.dll file although it is slightly varied eg. php5apache2_2.dll

I'm going to try and transfer this file into the php directory but something tells me an entire section is missing.

When I do cd: /usr/local/php/man/man1 and then ls

I see these files : phar.1 phar.phar.1 php.1 php-cgi.1 php-config.1 phpize.1

Wehn I run the module I see

httpd.exp libphp5.so mod_bwlimited.so mod_disable_swexec.so mod_security2.so mod_suphp.so

Anyway it is possible that none of this is relevant except for the conclusion that this seems like blatant sabotage in order to extract an additional $80.00 fee just for a few lines of code

At the very least, I have a reset function which will rewrite my apache httpd.conf file and I will have to resolve my website again... what can I say nothing good is ever easy
Copy linkTweet thisAlerts:
@GreenAce92authorDec 08.2014 — Well, indeed I am going the opposite direction of forward

I don't know if this is even possible but I got the impression that a file from my locally hosted server was uploaded to my GoDaddy hosted server, I don't know why, the only possible and partially related explanations are that I white listed my own IP addresses and that I am also hosting a server on my own computer... I don't know if Filezilla autosyncs or something I don't know ....

at any rate, Apaceh failed to restart, my three different website directories are gone

Hmmm


Log:

[Mon Dec 08 08:17:59 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

[Mon Dec 08 08:17:59 2014] [notice] Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations

[Mon Dec 08 08:50:35 2014] [error] [client 104.131.210.158] File does not exist: /usr/local/apache/htdocs/icons

[Mon Dec 08 08:59:49 2014] [error] [client 149.129.41.24] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /tmUnblock.cgi

[Mon Dec 08 08:59:59 2014] [error] [client 192.241.245.86] File does not exist: /home/dn2d8

[Mon Dec 08 08:59:59 2014] [error] [client 192.241.245.86] File does not exist: /home/dn2d8

[Mon Dec 08 09:01:52 2014] [error] [client 123.125.71.102] File does not exist: /home/cjdc/public_html/profile.html

[Mon Dec 08 09:15:36 2014] [error] [client 180.153.195.207] File does not exist: /home/soqui

[Mon Dec 08 09:15:36 2014] [error] [client 180.153.195.207] File does not exist: /home/soqui

[Mon Dec 08 09:23:30 2014] [error] [client 37.59.60.67] File does not exist: /home/cjdc/public_html/robots.txt

[Mon Dec 08 09:36:13 2014] [notice] caught SIGTERM, shutting down

No route to host... reset it is, fine my eyes are bloodshot, they need rest

Well I "undid" my edits, and apache restarted fine

When I add the AddType, restating this, every webpage is downloaded

I saw that I have libphp5.so and mod_suphp.so along with others not sure if that is useful

Now it is time for me to sleep

Thanks for any help, I'll be at it again soon
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — Ahh this is better, this is actually referring to my php code


Log:

[Mon Dec 08 18:32:48 2014] [error] [client 71.186.144.164] PHP Warning: mysql_query(): Access denied for user 'root'@'localhost' (using password: NO) in /home/cjdc/public_html/create-new-account.php on line 29, referer: http://dn2d8.com/index2.html

[Mon Dec 08 18:32:48 2014] [error] [client 71.186.144.164] PHP Warning: mysql_query(): A link to the server could not be established in /home/cjdc/public_html/create-new-account.php on line 29, referer: http://dn2d8.com/index2.html

[Mon Dec 08 18:32:49 2014] [error] [client 71.186.144.164] File does not exist: /home/cjdc/public_html/home, referer: http://www.dn2d8.com/create-new-account.html

[Mon Dec 08 18:32:49 2014] [error] [client 71.186.144.164] File does not exist: /home/cjdc/public_html/chillspot-top.png, referer: http://www.dn2d8.com/create-new-account.html

[Mon Dec 08 18:35:15 2014] [error] [client 71.186.144.164] PHP Notice: Undefined property: mysqli::$num_rows in /home/cjdc/public_html/create-new-account.php on line 22, referer: http://dn2d8.com/index2.html

[Mon Dec 08 18:35:15 2014] [error] [client 71.186.144.164] PHP Warning: mysql_query(): Access denied for user 'root'@'localhost' (using password: NO) in /home/cjdc/public_html/create-new-account.php on line 29, referer: http://dn2d8.com/index2.html

[Mon Dec 08 18:35:15 2014] [error] [client 71.186.144.164] PHP Warning: mysql_query(): A link to the server could not be established in /home/cjdc/public_html/create-new-account.php on line 29, referer: http://dn2d8.com/index2.html

[Mon Dec 08 18:35:15 2014] [error] [client 71.186.144.164] File does not exist: /home/cjdc/public_html/home, referer: http://www.dn2d8.com/create-new-account.html

[Mon Dec 08 18:35:15 2014] [error] [client 71.186.144.164] File does not exist: /home/cjdc/public_html/chillspot-top.png, referer: http://www.dn2d8.com/create-new-account.html

[Mon Dec 08 18:35:48 2014] [error] [client 71.186.144.164] File does not exist: /home/cjdc/public_html/skins, referer: http://dn2d8.com/

[Mon Dec 08 18:41:08 2014] [notice] caught SIGTERM, shutting down

These are the changes I applied

I opened up httpd.conf file using PuTTY SSH client

Under <IfModule mime_module> I entered

application/x-httpd-php php

application/x-httpd-php-source phps
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — Hmm now even if I undo the changes apache fails to restart.

I'm reading the rebuildhttpdconf

Sorry configuration data has not been successfully stored

Initial configuration generation failed with the following message:

Failed to build a syntactically correct Apache configuration

Bad configuration file located at ${test_httpd_conf}

EOM

#unlink $test_httpd_ocnf;

exit 1;

}

}

1;
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — Ahh this is good I figured out how to run /scripts/rebuildhttpdconf

missing IP for domain localhost.localdomain

missing servername

missing port using 80

missing user using nobody

missing owner force lookup to root

missing group using nobody

Built /usr/local/apache/conf/httpd.conf OK

Now to figureo ut where these changes go
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — Well this did not end well, I'm going to download all of my files from the server before I destroy and rebuild it. At least now I know how to access httpd.conf

I'll just work with some basic php scripts to get that to work

I know I have to go through the exhaustive options list to enable mysqli again
Copy linkTweet thisAlerts:
@NogDogDec 09.2014 — If you continue to have problems, there are a few guys over at http://board.phpbuilder.com/forum.php (a sister forum of this one) who might be able to help. Check out the "Install" sub-forum there.
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — thank you for the suggestion and link
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — Wow haha was this forum created like literally a few days ago?

I don't understand how the forum directory says the install page has 26,889 posts but when selecting that page there are 0 threads... ?
Copy linkTweet thisAlerts:
@NogDogDec 09.2014 — Wow haha was this forum created like literally a few days ago?

I don't understand how the forum directory says the install page has 26,889 posts but when selecting that page there are 0 threads... ?[/QUOTE]


I think that (for whatever reason) the default is to only show new threads/responses from the last week or 2 weeks. You may need to change the default setting if you just want to browse, otherwise try the search function (or just post a new thread ? ).
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — Yeah I saw that after I posted... still a lot less life than I expected

It is hard to get users, most of these websites use templates probably PHPBB

Usually it's a matter of who shows up first at the top, not sure if I can say that Google is a monopoly that their "algorithm" is biased but

This is an interesting "thing" to tackle
Copy linkTweet thisAlerts:
@NogDogDec 09.2014 — I've been on that forum for almost as long as this one: it's less traffic, but has some really good/smart regulars there who between them can answer most questions (though they expect you to do your homework, which it certainly seems like you do ? ).
Copy linkTweet thisAlerts:
@GreenAce92authorDec 09.2014 — yes I do, unfortunately this is more of a business venture rather than a "joy of learning" situation, this isn't my passion but I am capable of learning and thinking logically / building stuff

Anyway, thank you for referring me to that page, it has been very helpful, one particular person, a moderator as well
×

Success!

Help @GreenAce92 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...