Reputation: 2975
I am a beginner of web development and just started to learn about a month
intro:
I recently come across SQL injection and decided to look it up. After summarizing it, I tried to upgrade my cpanel php version from 5.3 to 5.4 due to PDO support. So I was messing around with .htaccess
file and after I uploaded my new .htaccess
file I can no longer view my php page again. I don't remember what codes did I put.....
Question: What should I do to undo my stupidity?
Tried solution:
I loaded up codes in .htaccess file with
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
AddType application/x-httpd-php php
(from Browser ask me to download php file)
and still the same result
Sorry for my bad English practice
Update:
I was browsing my website again, and somehow got into an error saying
500 - Internal Server Error
, so I decided to delete all my files in public_html file. Then,I re-upload all my web file again and suddenly it all worked. Did not download php file again.
Thanks for everyone who spends time on looking at my problem. I apologize to all the contributor.
The file name on both regist and register have a extension name of .php
Upvotes: 0
Views: 3052
Reputation: 31614
You're being asked to download the file because the server no longer recognizes the file as something it needs to process.
I'm not sure why you would need all the PHP declarations in your .htaccess
file (especially LoadModule
). Normally those are stored in config files (files like /etc/httpd/conf.d/php.conf
). Here's what the default on my box looks like (this is for Apache so YMMV)
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
#<IfModule prefork.c>
<IfModule !worker.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
#AddHandler php5-script .php
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
Upvotes: 1