I have a php file that handles contacting me from my site via email. I don't know much about php but when i use node all i have to do is start up my node server file and the whole site launches. My front end is html/javascript and the only "backend" is the contact_me.php. I need to be able to have my php running so that it works with my site. I know nothing about apache. If you could tell me how to setup what i need to setup or point me in the right direction that would be awesome. I have tried reading the documentation for apache to no avail.
PHP mail manual will help you set up mail in php.
If you are new to this, its better to use some inbuilt libraries like PHPMailer which have decent enough documentation for beginners.
Related
ve been trying to make a server side site recently on Github but the php code will not run, I have put in a .htaccess but it still wont work, I was wondering if I need to put some library into it to interpret it but other peoples php codes seem to be working without anything like that. Any Ideas?
From https://help.github.com/articles/what-is-github-pages/:
GitHub Pages is a static site hosting service and doesn't support server-side code such as, PHP, Ruby, or Python.
I am working with some code for uploading images to a server on android. I am working on my local xampp server. I do have Restler and PHP installed on it for REST services at the moment.
I was working modifying the code in this tutorial.
I installed an external jar file for the http client errors. But I cannot install coldfusion as it appears to require a commercial license of some sort and this is what this tutorial is using. As I said, most of the code is in that tutorial besides downloading the latest http client jar file here. What I'm really asking is what alternatives to this cfc function are there? And preferrably what php alternatives are there? Please let me know if I should clarify anything else. Thank You.
Cormac, the only ColdFusion consideration here is that the blogger uses a CFC as a web service within one of their Java classes (it's not great to have a dependency like that in there, but oh well). So what you're gonna need to do is to find out what that web service does, and roll your own. On the basis of the info you have given is, we can't tell you what the web service does... I recommend you touch base with the blogger and ask them. They'll almost certainly flick you the code, and then we can have a look at that if you need further help.
As in JSP we give "WAR" file to clients and it contains .class files and other configuration files but not the source code, is there any way, in PHP, to deliver the project (website) to client without giving them source code.
Facebook created a project called HipHop php, a php compiler.
See this post:
Can you "compile" PHP code?
Short answer, not really.
I mean you can compile php into a single .phar file however anyone with moderate php knowledge can get the code from that.
There are also solutions http://www.ioncube.com/ though I don't know how easily someone can get the code from it however I would strongly advise against any solution like this as they generally require the user of this "compiled" code to you their proprietary software to run it.
Please forgive the simplicity of this question. The answer will be obvious to many of you. But since I'm completely new to php and JSON, and I can't find a concrete answer on Google, I need to ask.
I have the following:
Client side Android app
mySQL database on server
JSON in between
The question is very simple. Where on the server do I put the php file? Any directory? A specific location? I just need a simple working answer. Not concerned about security or anything fancy at this stage. Please help.
Also, does anyone know of a very simple tutorial that talks about php, json, and working on the server side for someone like me who's completely new to it?
Your server must be available with a one of the given folders
public_html
www
htdocs
if any of the folder you can see in your server then this is the place where you need to place your php files
basic Introductory Tutorial for PHP with examples
tizag.com
Basic Introductory Tutorial For JSON
JSON
JSON with PHP
As long as the php file is accessible by http you are fine. So pretty much anywhere.
here is a tutorial. http://www.itnewb.com/tutorial/Introduction-to-JSON-and-PHP
To run your php script you will need an http server on your server that handles php script.
For example you can use the apache web server with mod_php. You then can put your php file in the server default web folder or configure another one.
So I would like to be able to call the unix mail function form a PHP script. Yes, I know PHP has a built in mail function itself, but I am having issues with the PHP config on my intranet server and have been trying very hard to resolve with no such luck. I figured it would be easier to just invoke the Unix mail function (since I know it works with other scripts) from PHP instead of trying to re-configure the PHP install, which could end up messing things up for other sites. Could someone explain how to accomplish this as well as how I can set up an email template to be sent out in the email? Thanks in advance !!
Brett
Calling unix commands directly requires that your php install be allowed to execute shell commands which is dangerous and really should only be done in cases where there is not a suitable pure php wrapper. There is a suitable wrapper in php. What problems have you been having with it?
To answer your question, look at the exec() function. Unless php is configured to disallow it, that is how you call external commands from within php. I still recommend against it.
For generating and sending e-mail from a php web application, I find that the phpMailer is an excellent easy to use php class.
Try something like
system('/usr/bin/mailx -s "Your Subject" rcpt#example.org < /tmp/mailfile.txt')
Be careful if the input is accepted from the user, read these first:
http://php.net/manual/de/function.system.php
http://www.php.net/manual/en/function.escapeshellcmd.php
http://www.php.net/manual/en/function.escapeshellarg.php
All in all, it would be much safer and portable to use the mail functions available in PHP. Also, your provier may disable the system and similar functions (by using safe_mode).