Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
My php files if opened via the localhost (i used httpd-2.2.25-win32-x86-no_ssl.msi and the apache server is running with PhpMyAdmin files placed in apache/htdoc) are shown as text files in my browser:
for example if i wrote a something in my php file, as soon as i open that file either via my local webserver or opening the file directly, it will be shown as text! Please help.
You haven't configured Apache to send PHP files to the parser. As such, the format will remain unrecognized and be displayed as text or be downloaded to the client. Assuming you're using a PC or a Mac, most every guide to setting up Apache with PHP will explain how to do this.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Is there a known way to hide PHP code within a file?
I got an error message referencing a malware variable in a php file on a wordpress website.
When I grep for the variable it shows me the malware in the file
When I open the file in nano it doesn't show
When I download via sftp the malware doesn't show in notepad++
I'm wondering if:
grep could somehow be seeing 'cached files'?
is there is a way to hide php code?
has anyone using php or wordpress ever seen something like this?
I did everything to double check, yes these are the same files and all the other tips that were pointed out. opcache is off. I have no idea.
Removing face palming situations from the equation (e.g. downloading the wrong file, downloading from the different server - which have happened to me before ;)), maybe you could try to use
grep -n [variable name]
to figure out the line (-n) where the variable is in the file. That might help you.
Another suggestion is downloading the file and using diff tools against a known good version of the infected file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I know you can connect to a database with mysqli_connect("example.com","user","pass");, but wouldn't anyone who has access to the file have access to the database since he can see the user and password? How to change that?
PHP is a server-side language. You can't see php code in your browser. Unless your php "echo" or "output" something out. You can see "html","css","javascript" codes by clicking veiw source on your browser. But you'll never see "PHP" or "ASP" code because they are server side. The server process the command , not the browser. So you can be sure that no one will see your password unless they gain access to your website's files.
You always will need the password and username to connect.
You can of course deny access to the file that contains you data by a .htaccess file. However it is always smart to keep those settings in a settings file that is placed outside of your browse able content (and preferably your git or svn repo as well).
Like that people need access to your server (or a big error in the code) to be able to access that file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I would like to create a PHP form that is going to run on a local machine(WAMP).
This form is going to upload a file to a web server and echo the url of the uploaded file.
My skills in php are low, I can understand a code but I have difficulties writing one.
Your help will be appreciated.
Here's a start. Have a look at these tutorials
http://www.tizag.com/phpT/fileupload.php
http://www.dzone.com/snippets/very-simple-php-file-upload
http://www.htmlgoodies.com/beyond/php/article.php/3472551
http://www.sitepoint.com/file-uploads-with-php/
UPDATE:
If you want to use a local version and FTP the file to another remote location have a look here
http://nirvaat.com/blog/web-development/uploading-files-ftp-server-php-script/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have done this a million times with no issue, but for some reason today, if I do this:
include_once('phpocr/config.php');
It doesn't execute the php in the file. it prints out the php code in the file. For all intents and purposes, just imagine that this is the content of the file:
<? class myClass {
} ?>
And when I include that file, it literally prints out: "class myClass { }". Why? And how do I fix it?
The problem was that the script that i'm using has the following opening tags
<?
My web server is set up to only accept
<?php
Are you new to web programing ?
I guess that you're intent to run the php script through apache web server, all right?
If then you should set up the php module for apache as following
LoadModule php5_module /path/to/php5_module.so
With the above module, apache just regard the php script as normal text
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have been using Lampp on a test machine. OS is Ubuntu 12.1. It was working fine before and running my scripts. Then it began displaying a pop-up asking me if I would like to open or save the file? I have tried changing the ports and restarted the machine and restart Lampp. Nothing has worked so far though.
Your MIME types are wrong and/or mod_php isn't loaded.
What is in the files? If they contain your PHP code, Apache is serving the files out rather than putting them through PHP. Check you are loading mod_php.
If they contain the output of the PHP code (i.e. the HTML) then they aren't being given the correct MIME types. I'm not sure where this is done, I think Apache or PHP adds the headers automatically. Check the Apache MIME types config