Hi
I want to write a php script which updates svn working directory
I tried with below code , but it does not work.I guess because the USER for php script is "apache" but for svn update it needs to be "homeuser"
putenv("USERNAME=homeuser");
putenv("HOME=/home/homeuser");
exec("svn update /home/homeuser/path/to/working/dir", $info); //svn update with full path
print_r($info);
how to get around ?
Hello, I've recently started learning PHP, but I have a wide knowledge on C++. I've been wondering how to make a web bot and now, I would greatly like to make one. I won't be using this robot for spamming or anything, just as a test of what PHP/C++ can do online. I was wondering how I could go about doing this and if you have any articles/tutorials that would be helpful.
Thanks,
John
i have a submit page in html. when i submit the form data, it goes to a php page, which inserts the data in the database.
my question is how would i ensure that the data on the html page is not null or empty without using javascript? is there anyway this could be done in php? thanks!
I keep getting this error, although the file still gets moved into the correct directory. Anybody know why i'm getting this error?
Warning: rename(../Images/uploaded/1162504_56863010.jpg,../Images/uploaded/Portraits/1162504_56863010.jpg) [function.rename]: No error in D:\Data\Websites\wamp\www\StephsSite\PHP\addImage.php on line 21
I need some PHP classes that deal with image processing in a good manner. I have made a thumbnail creator myself but the end result quality is just horrible.
Is it also possible to let PHP convert and save all images to one type. For example take an image(jpg,png,gif), compress it, resize it, and save as png.
Can anyone recommend some good classes for this.
I have been playing around recently with jqgrid and am at loss on how to implement search in my controller using PHP (Zend).
I came across a post that is quite similar to the answer am looking for but what I need is the PHP version not ASP.NET.
i coded a random quote generator in php using mysql but also jquery. however when i try to integrate it with facebook, since i opted to use fbml, i could not use jquery.
how do i get the quote to display randomly in php at say, 30 mins, without using jquery or javascript?
Hi,
I am developing online video streaming website on PHP.
I need two functionalities:
Need to add title/text at bottom of the video dynamically.
Need to add background music to video dynamically.
Is it possible with PHP or any available open source library?
Can anyone guide me or provide links to this type of library ?
Thanks.
hi
i am trying to set up a home page with an email form, where i can fill out email address and subject and comments and the php page will run
mail -s [email protected] $comments
how can I do this via php to call the linux command?
thanks in advance
hey
i made a script that uploads files to different servers using php curl and the problem is that it eats all my upload bandwith and my apache does not respond as i would like.
the call is made from the php-cli and can not use any apache bandwith limiting bandwith
thanks in advance
I'm writing a web application in which i use several thirdy party commands calling them with the exec function in PHP (for example, I render Latex formulas through a command-line program).
My question is: what are the security issues of executing external command-line programs in php? What I have to be aware of? Can you give me a list of points to check?
Thanks in advance.
I have this PHP code:
<?php
$username="root";
$password="******";// censored out
$database="bazadedate";
mysql_connect("127.0.0.1",$username,$password); // i get unknown constant localhost if used instead of the loopback ip
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM backup";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
$raspuns="";
while ($i < $num) {
$data=mysql_result($result,$i,"data");
$suma=mysql_result($result,$i,"suma");
$cv=mysql_result($result,$i,"cv");
$det=mysql_result($result,$i,"detaliu");
$raspuns = $raspuns."#".$data."#".$suma."#".$cv."#".$det."@";
$i++;
}
echo "<b> $raspuns </b>";
mysql_close();
?>
And it should return a single string containing all data from the table. But it says "connection reset when loading page".
the log is :
[Tue Jun 15 16:20:31 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Tue Jun 15 16:20:31 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Tue Jun 15 16:20:31 2010] [notice] Server built: Dec 10 2008 00:10:06
[Tue Jun 15 16:20:31 2010] [notice] Parent: Created child process 2336
[Tue Jun 15 16:20:31 2010] [notice] Child 2336: Child process is running
[Tue Jun 15 16:20:31 2010] [notice] Child 2336: Acquired the start mutex.
[Tue Jun 15 16:20:31 2010] [notice] Child 2336: Starting 64 worker threads.
[Tue Jun 15 16:20:31 2010] [notice] Child 2336: Starting thread to listen on port 80.
[Tue Jun 15 16:20:35 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Tue Jun 15 16:20:35 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Tue Jun 15 16:20:35 2010] [notice] Server built: Dec 10 2008 00:10:06
[Tue Jun 15 16:20:35 2010] [notice] Parent: Created child process 1928
[Tue Jun 15 16:20:35 2010] [notice] Child 1928: Child process is running
[Tue Jun 15 16:20:35 2010] [notice] Child 1928: Acquired the start mutex.
[Tue Jun 15 16:20:35 2010] [notice] Child 1928: Starting 64 worker threads.
[Tue Jun 15 16:20:35 2010] [notice] Child 1928: Starting thread to listen on port 80.
Any idea why it outputs nothing?
I ask this question because i learned that in programming and designing, you must have a good reason for decisions. I am php learner and i am at a crossroad here, i am using simple incrementation to try to get what im askin across. I am certainly not here to start a debate about the pros/cons of pointers but when it comes to php, which is the better programming practice:
function increment(&$param) {
$param++;
}
Or
function increment($param){
return $param++;
}
$param = increment($param);
I have been asked to include some html snippet in this php/smarty page. It's basically a sales agreement at the end of an overview page before you pay.
What is the code to include static html into my php/smarty template?
Thanks...
I'm interested in literature (articles on internet, in magazines, books, podcasts - I don't really mind anything) that describes how PHP works internally, about its gotchas and perhaps some advanced functions. Is there anything like this out there? I tried to search on Google, but majority of articles were about starting with PHP and its basic functions.
Any input is really welcome as I'm trying to understand the language internally - I'm tired of my mindless typing of code without understanding its essence.
Is there anyway to find the month difference in php? I have the input of from date 2003-10-17 and todate 2004-03-24. I need the results how many month is there within these two days. Say if 6 months, i need the output in months only. Thanks for guide me for day difference.
I find the solution through mysql but i need in php. Anyone help me, Thanks in advance.
Hello everybody!
I've been wondering whether is possible or not to pass a function as parameter in PHP; I want something like when you're programming in JS:
object.exampleMethod(function(){
// some stuff to execute
});
What I want is to execute that function somewhere in exampleMethod. Is that possible in PHP?
Thank you so much.
Hello,
I'm trying to upload videos in Youtube through HttpWebRequest. Everything seems to be fine when uploading following the example given in API documentation.
I see that request is being formed correctly, with content and token sent but I receive "Incomplete multipart body" as response.
Thanks Blerim
public bool YouTubeUpload()
{
string newLine = "\r\n";
//token and url are retrieved from YouTube at runtime.
string token = string.Empty;
string url = string.Empty;
// construct the command url
url = url + "?nexturl=http://www.mywebsite.com/";
// get a unique string to use for the data boundary
string boundary = Guid.NewGuid().ToString().Replace("-", string.Empty);
foreach (string file in Request.Files)
{
HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase;
if (hpf.ContentLength == 0)
continue;
// get info about the file and open it for reading
Stream fs = hpf.InputStream;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.ContentType = "multipart/form-data; boundary=" + boundary;
webRequest.Method = "POST";
webRequest.KeepAlive = true;
webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
MemoryStream memoryStream = new MemoryStream();
StreamWriter writer = new StreamWriter(memoryStream);
//token
writer.Write("--" + boundary + newLine);
writer.Write("Content-Disposition: form-data; name=\"{0}\"{1}{2}", "token", newLine, newLine);
writer.Write(token);
writer.Write(newLine);
//Video
writer.Write("--" + boundary + newLine);
writer.Write("Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"{2}", "File1", hpf.FileName, newLine);
writer.Write("Content-Type: {0}" + newLine + newLine, hpf.ContentType);
writer.Flush();
byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes(string.Format("--{0}--{1}", boundary, newLine));
webRequest.ContentLength = memoryStream.Length + fs.Length + boundarybytes.Length;
Stream webStream = webRequest.GetRequestStream();
// write the form data to the web stream
memoryStream.Position = 0;
byte[] tempBuffer = new byte[memoryStream.Length];
memoryStream.Read(tempBuffer, 0, tempBuffer.Length);
memoryStream.Close();
webStream.Write(tempBuffer, 0, tempBuffer.Length);
// write the file to the stream
int size;
byte[] buf = new byte[1024 * 10];
do
{
size = fs.Read(buf, 0, buf.Length);
if (size > 0)
webStream.Write(buf, 0, size);
} while (size > 0);
// write the trailer to the stream
webStream.Write(boundarybytes, 0, boundarybytes.Length);
webStream.Close();
fs.Close();
//fails here. Error - Incomplete multipart body.
WebResponse webResponse = webRequest.GetResponse();
}
return true;
}
How can include CodeIgniter content in a regular PHP page on the same server but not part of the CI app?
For example I'm am trying to load a header from CI into Wordpress. Whats the best way to include a CI controller (eg; index.php/mycontroller/header/) on the same server?
Possible Duplicate:
What PHP-specific questions would you ask in a job interview?
What topics, areas and interview questions should be covered in order to assess candidate for PHP Developer Position ?