Flock() Fails With Exec()
My flock() code works fine when run live to the user over http However when the same code is spawned via exec() it all works except the flock():
flock($handle, LOCK_EX + LOCK_NB) always returns an error (never gets the lock)
(Yes I have checked that $handle is valid
Yes I do have backoff and retries
Permissions on the file are set to 777)
Now, I suspect the answer is not to use flock() at all, rather than try to resolve this problem. Code:
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Exec() Fails...help!
I'm very new to php, running apache 1.3.20 with php 4 on a 98 box just for home test development purposes there's probably an easier way/better alternative to do what i'm trying to do, but i'd be greatful for solutions not alternatives i'm trying to add a user to an .htpasswd file so need to exec("c:/apache/htdocs/htpasswd.exe -b .htpasswd user password) It would also be useful to run a mail server remotely with exec("c:mymailserver.exe") but neither will work, i tend to hear the standard windows error sound, but with no message. Apache error logs reveal nothing. What i'm trying to do may be impossible?, i'm new to the language so i don't know...or it may be a permissions problem? Or perhaps something totally seperate? If anyone has any ideas which may help i'd be very greatful for any advice you could give.
View Replies !
View Related
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working. I'm trying to use ftp_exec to execute some simple command: $conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host"); ftp_login($conn_id, "$username", "$userpass") or die("Cannot login"); $command = 'cd..' if (ftp_exec($conn_id, $command)) { echo "$command executed successfully"; } else { echo "could not execute $command"; } ftp_close($conn_id); I'm getting the following error: Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21 could not execute cd.. Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..
View Replies !
View Related
Flock
If I open a file with mode 'a' (ie fopen('file','a')), must I use flock to prevent concurrency access ? I'm on a single server with no network file system.
View Replies !
View Related
Flock?
What is this? flock($fp, 2); Saw it in my book in a code example but can't find the mearning of the "flock" statement anywhere.
View Replies !
View Related
Using Flock
i got guest book scripts that using filesystem ...but i have difficult in using flock in my scripts.. here the code: $logfile="data.txt"; $fp = fopen($logfile, "a"); $fw = fwrite($fp, $text); fclose($fp); how to use flock in the scripts cause my operating system is window.
View Replies !
View Related
When To Flock
I've got a script which writes my blog's RSS feed (rather than dynamically generating it each time it is requested), and I'm not sure whether I should lock the file while I'm writing it. Truth is, the only way this script runs is through cron anyway, and I recently read that "Other processes can modify or delete a PHP-locked file if permissions allow." which seems to be a waste of time, anyway.
View Replies !
View Related
Flock()
I've got a PHP program that I've added flock() to in order to protect multiple scripts trying to write to the same file. After I added the flock() to the code the performance of the code went way down.
View Replies !
View Related
Flock Error
I keep getting a flock error on line 99. Here is the link with all the php..orderform.html is the start page, thanks guys for your help. By the way, my order cannot be processed, I have no idea why, it workes on my local apache server, but not on that server. Maybe its the placement of the orders.txt?
View Replies !
View Related
Php Flock Function
I'm using the php flock function to lock a file. The file locks fine cause the function returns true. What i would like to know is it possible to lock the same file using perls flock function in a perl script. The php or perl scipt need to lock the same file at different times but not at the same time. Will the flock functions realise when the other script has locked the file and return false. I should think the functions wotk at system level.
View Replies !
View Related
Gzopen() And Flock()
i've a problem with file locking. seems that flock() and gzopen() do not work together. i get the error (or warning) message ... Warning: flock(): cannot represent a stream of type ZLIB as a File Descriptor in ... when using flock() after gzopen(). sourcecode looks like this ... ... $entry_file = gzopen($entry_filename,'r'); // read content of entry_file (with read lock) flock($entry_file, LOCK_SH); .... i am using php 4.3.3 as apache modul on windows xp, on my webhosters webserver php 4.2.3 on linux (where i've not tested yet). does anyone has an idea what i am doing wrong or of an easy workaraound?
View Replies !
View Related
Can't Understand Flock()
I've scoured over manual page for flock on http://in2.php.net/flock but I can't understand a few things: 1. will flock wait until a different process releases the lock ? 2. please clarify this line: " If you don't want flock() to block while locking, add LOCK_NB " what does "block" mean above? I'd like to use flock() in a manner that when locking attempt fails on a file (maybe it is alreadly locked by some other process) then the script wouldn't wait but go on and do something, eg: close the file.
View Replies !
View Related
Flock Won't Non-block At All
I'm trying to just prevent multiple instances of a script running. I would have thought that the following code would do this for me. <php $fp = fopen("foo.txt", "w"); flock($fp, LOCK_EX + LOCK_NB) or die ("Could not get lock! "); echo "Got lock! "; sleep(10); flock($fp, LOCK_UN); ?> The first script to run would obtain the lock on the file, and would execute. Any other scripts would fail immediately (because of my non-blocking LOCK_NB). But it seems that ALL of my scripts just wait, and ALL of them end up printing "Got lock!" Can anyone help me out?
View Replies !
View Related
Flock Or Database
I have written a simple guestbook in php which writes the contents in a file while using flock. But I have read that this is not always save. So some people suggested to use a database instead. But if I use mysql, then my customers have to pay more for the webspace. Actually, I would prefer to use a simple database like dbm (http://www.php.net/manual/de/ref.dbm.php) and write the information in a local file. Under http://www.php.net/manual/de/ref.dbm.php in the last not of the User Contributed Notes some says that the return codes are nadly documentated or wrong. Is dbm a save way to give several scripts/processes at the same time the ability to read/write from the same file. Or are there maybe others which php programmers prefer. But remember I want to write the data to a file and not to database service..
View Replies !
View Related
Flock() : Must I Use It If I'm Only Appending To A File?
I have a php script for which I want to make sure it's data file doesn't get corrupted. The file is just a log; I must only append to it, not change any of the contents. Do I need to flock() the filehandle for this purpose??? Also, I have a related script that reads the log, but does not write to it. Must I use flock() here? It seems to me that I should have to use flock() for appending, but not for reading, but I'd have to make sure that the last line of the log file is not half written or something. But I appreciate other's thoughts.
View Replies !
View Related
Flock And File Access
I am making the not so smooth transition from Perl to PHP and my question concerns file locking. PHP has a myriad of file parsing functions an many do not appear do give access to a file handle for flock, i.e., file(), parse_ini_file()...convenient since they dump into an array, I have data in TSV (tab separated value) files. Do the functions other than fopen() use some internal locking? Even on reading, good practice to flock LOCK_SH. Been referencing manual and 'cuckoo' book but haven't found the answer.
View Replies !
View Related
Flock And Reading File Into Array
Do I need to use flock() when reading a file into an array? It's possible that the file in question could be open at the time the file('filename') request is made. I realize flock() is required when opening a file with fopen() when there is contention for the file: $fp=fopen($ctr, 'w'); //only write if we can get lock on file if (flock($fp, LOCK_EX)) { fwrite($fp, "0"); flock($fp, LOCK_UN); } else { //try again... how??????? } fclose($fp); but is it required when reading a file into an array? $totals=file('visinterval'); $var=explode('|',$totals[0]); $i24h = number_format($var[0]); $i30d = number_format($var[1]); $i365d = number_format($var[2]); if the attempt to get a lock on the file fails (in the first example), how do I retry?
View Replies !
View Related
How To Test If FLock Function Is Working
I believe the syntax is correct but how would I test to see if the txt file is indeed being locked and unlocked after being written to? $fp = fopen($settings['idfile'],"wb") or die("Can't open the id file ($settings[idfile]) for reading!"); flock( $fp, LOCK_EX ); fputs($fp,$previd); flock( $fp, LOCK_UN ); fclose($fp);
View Replies !
View Related
Flock() Permission Denied Error
when using flock() I get a permission denied error: Warning: fopen("<filename>", "r+") - Permission denied in <pathtofile> on line 7 $fileToOpen=substr($PHP_SELF, strrpos($PHP_SELF,"/")+1); $fileHandle=fopen($fileToOpen, 'r+') or die($php_erormsg); flock($fileHandle,LOCK_EX | LOCK_NB); $fileString=fread($fileHandle, filesize($fileToOpen)) or die($php_erormsg); // ,, // procesing of filecontents // ,, rewind($fileHandle);
View Replies !
View Related
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error : Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62 Below is my script : <?php $line1 = exec("ping 10.8.1.70", $output); exit; ?>
View Replies !
View Related
Gettext Fails Me
I can not get gettext to work at all under PHP. I run ubuntu 6.06.1 LTS, and the php5 package there announces that it supports gettext. Also, php -i sais gettext GetText Support =enabled, so it should be working. Here follows a minimal example that should be working, but isn't (gettext and msgfmt are the normal GNU gettext tools): [redhog@thalari:~/Projects/DemoWave]$ cat foo.php #! /usr/bin/php <?php bindtextdomain($argv[1], $_ENV['TEXTDOMAINDIR']); echo dgettext($argv[1], $argv[2]); ?> [redhog@thalari:~/Projects/DemoWave]$ cat locale/sv_SE/LC_MESSAGES/demowave.po # SOME DESCRIPTIVE TITLE. # Copyright (C) 2006 RedHog (Egil Möller) <redhog@redhog.org> # RedHog (Egil Möller) <redhog@redhog.org>, 2006 # msgid "" msgstr "" "Project-Id-Version: DemoWave 0.9" "POT-Creation-Date: Sun Oct 24 19:51:42 2004" "PO-Revision-Date: 2004-10-24 21:02+0200" "Last-Translator: RedHog (Egil Möller) <redhog@redhog.org>" "Language-Team: " "MIME-Version: 1.0" "Content-Type: text/plain; charset=UTF-8" "Content-Transfer-Encoding: " # msgid "A message" msgstr "Ett meddelande" [redhog@thalari:~/Projects/DemoWave]$ msgfmt -o locale/sv_SE/LC_MESSAGES/demowave.mo locale/sv_SE/LC_MESSAGES/demowave.po [redhog@thalari:~/Projects/DemoWave]$ ./foo.php demowave "A message" A message[redhog@thalari:~/Projects/DemoWave]$ [redhog@thalari:~/Projects/DemoWave]$ gettext demowave "A message" Ett meddelande[redhog@thalari:~/Projects/DemoWave]$ [redhog@thalari:~/Projects/DemoWave]$
View Replies !
View Related
PHP Upload Fails
I'm trying to create a form to upload PDF files to a server, these files can by huge (+150 MB), this shouldn't be a problem because it is a LAN network. But when I try to upload a 159 MB file to the server as a test, the browser acts as it was searching for the next page, probably is. But after 1 half hour still nothing happened? Now I solved this problem by installing an ASP script, but I don't want to use ASP cause it doesn't work on *nix. Smaller files (< 10MB) are no problem. These are uploaden and moved to the specified directory real fast.
View Replies !
View Related
PHP Build Fails With GD
I have libpng installed, and it keeps saying it can't find png.h. It's located in /usr/local/lib and I've tried pointing in the ./config to the directory, and it still says it can't find it. The install command to libpng did fail, but I copied the .h files manually and symlinked them in the lib/ directory. FreeBSD5.3-RELEASE i386 PHP 5.0.2 libpng 1.2.8
View Replies !
View Related
Mysql_connect Fails
i'm baffled. or maybe missing the obvious .... when requesting a particular page, which attempts to connect to my MySQL server, at least one user receives the 'Can't connect ...' message: Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/www/users/.../xyz.inc.php on line 108 line 108 of the included file is: $link = mysql_connect ($h, $u, $p) ; the user has no problem with the rest of the site, but always has this problem if the page requested attempts to connect to the server. no other user has reported the problem and this user is reliable. i really can't see how the user's browser or firewall could cause this, but ....
View Replies !
View Related
The Following Code Fails
<?php $filename = "mess.xsl"; $xmldoc = domxml_open_file("mess.xml"); $xsldoc = domxml_xslt_stylesheet_file($filename); $result = $xsldoc->process($xmldoc); echo $xsldoc->result_dump_mem($result); ?> I try to output a message "welcome" in xml file onto the screen but it does nothing. If I execute raw the xsl file, I can see the message. Do you know why ?
View Replies !
View Related
DJ Expression Fails
provide an explanation why the following DJ regular expression woes with an invalid regular expression runtime error 107? Thanks Fields("legal description") Like "SEC [1-36] T[37-43]S R[9-20]W"
View Replies !
View Related
Query Fails
I have a query: $SQL = "SELECT * FROM table WHERE id=".$_GET['id']; But if I add order by to it: $SQL = "SELECT * FROM table WHERE id=".$_GET['id'] Order by table_id; It fails? I know it's something to do with the " being out of place, but surely it has to be there?
View Replies !
View Related
PHP CURL Fails
Trying to get curl running in the following environment: Vista with IIS7 PHP 5.2.0 Tried the following things: 1) Put copies of libeay32.dll and ssleay32.dll into windows/system32 2) Uncommented extension=php_curl.dll in php.ini 3) Declared PHP path and PHP/ext path in System Env variables 4) Verified IUSR has permissions to read/exec all DLLs. 5) Restared computer repeatedly. I get standard "Fatal error: Call to undefined function curl_init()" when I try to run curl,and there is no mention on curl in phpinfo().
View Replies !
View Related
Mkdir Fails
I have a mkdir script but it doesnt work, the file locations are correct 100% and so is $login but it doesnt create the folder and chmod it. <?php $login = $_GET['login']; mkdir("/var/www/vhosts/website.co.uk/subdomains/demo/httpdocs/clients/$login"); chmod("/var/www/vhosts/website.co.uk/subdomains/demo/httpdocs/clients/$login", 0777); Â ?>
View Replies !
View Related
Post Of Fetched Value Fails
I have a MySql db, in which I search for values to populate a selection box, as follows : <select size="1" name="customer"> <option selected="selected">(not queried)</option> <?php while($nt=mysql_fetch_array($result2)){ echo "<option value=$nt[customer]>$nt[customer]</option> ";} ?> </select> This works fine, all the customers appear with their complete names, including spaces if there are. When I do a submit of the php page containing this part of code and in this page I do a $customer=$_POST['customer']; then the value of $customer is cutted to the first <blank(space) encountered. E,g, : if in the selection box the customer name John Smith appears, then I get in the result page after the submission as customer=John When I make a selection box, with fixed populated values (so values not fetched from the db) then after the submission, I get the correct info (values are not cutted to the first space). Is there anybody out there that can give a solution for this strange (to me) behaviour ?
View Replies !
View Related
Apache 2.2.3 PHP 4.4.5 Install Fails
I have Apache 2.2.3 installed and running on WinXP Pro SP2. I installed PHP 4.4.5 and added the following lines in httpd.conf PHPIniDir C:/PHP445/ LoadModule php4_module C:/PHP445/php4apache2.dll When I restarted Apache, i got this error: The Apache service reported the following error: Quote:
View Replies !
View Related
Setcookie Fails To Set Cookie!
Fourth attempt.. it fails now in login, I check by printing $_COOKIE['nordicnet_registration'] and there is no value there! Guys, what on earth do I do about this???? Here is the code that sets the cookie: if ($hasLoggedIn && ($row = mysql_fetch_row($query))) { setcookie('nordicnet_registration', $row['nnet_user_registrationnumber'], 0, '/'); @mysql_free_result($query); mysql_close($dbConn) or die('Could not close db'); $html .= $font . '<font color=000099>Takk for logging inn. For forsatte' . "<a href=http://$serverName/index.php?content=membersites/Palogget%20S1.php " . ' target=_top>klikk her</a></font></font>'} else if (sizeof($_POST) > 0) { $errorMsg .= $font . '<font color=cc0000><li>Det finns en problem med db</li></font></font><p>' $hasLoggedIn = 0; } Because the PHP script is in a frame, instead of using header() I print out some text with a link <a href=mylink.php target=_top> for the user to click and to go to another page. By then the cookie should be registered, yet it's not there!
View Replies !
View Related
Sending Twice A Fdf Form Second One Fails
I have written a data handling tool in php and probably you all know already what are my problems. Lets explain: I have found some strange behaviour in Internet Explorer filling out a form to get some data to download. After saving the data file an additional dialogue is displayed on IE. This is not in the other browsers (mozilla, firefox) The possibilities are, open : file is opened from local view dir : shows dir close : it does close and an addtional usage of the data in the form is not possible but it is shown there. But I just only want to close the dialogue not the connection. If I use mozilla, firefox I could several time download the data file without an error. I have searched the web and probably does not have the best wording for the problem. But I don't have found a question or solution about this. Sorry, I am not an Internet Explorer Expert. Is this normal in this browser?
View Replies !
View Related
System() Function Fails
In a e-commerce site, our bank has given us a Java class that generates a key to validate an order. To make it work, it must be called something like this: /usr/sbin/java/bin/java -cp /home/users/mysite/tpv.zip CrURLtpv /home/users/mysite/ orderid:0016 ammount:12.00 moneda:XEU language:eng When via telnet I execute this command, it outputs a URL, which can be used to call the bank secure pay page. Now, obviously I need to get this URL from the PHP script, so I use the system() function and to my surprise I only get this error: Error occurred during initialization of VM Could not reserve enough space for code cache Any idea why is this happening? I'm sure the Java class is ok since it works properly when called from prompt. Does the system() function have any memory limitations, or something that may be altering the execution of the class? Is there any way to increase the ammount of memory that is available to the system() function to execute a command?
View Replies !
View Related
Trying To Make A Thumbnail But Fails
I created a file name image.php which contains only the following code: <?php function createThumbnail($picture,$thumb,$new_w,$new_h) { $extension=substr($picture,strrpos($picture,".")+1); switch (strtolower($extension)) { case "jpg": case "jpeg": $src_img=imagecreatefromjpeg($picture); break; case "png": $src_img=imagecreatefrompng($picture); break; case "gif": $src_img=imagecreatefromgif($picture); break; case "bmp": $src_img=imagecreatefromwbmp($picture); break; } $old_x=imagesx($src_img); $old_y=imagesy($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); }elseif ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; }else{ $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thum b_w,$thumb_h,$old_x,$old_y); switch (strtolower($extension)) { case "jpg": case "jpeg": imagejpeg($dst_img,$thumb); break; case "png": imagepng($dst_img,$thumb); break; case "gif": imagegif($dst_img,$thumb); break; case "bmp": imagewbmp($dst_img,$thumb); break; } imagedestroy($dst_img); imagedestroy($src_img); } ?> This function successfully creates a thumbnail. The problem is that I include it in another page (with include_once, just if it matters) which creates a thumbnail, makes some db updates and then redirects to another page. When trying to redirect with header("Location: index.php"); it echos that header has already been sent from image.php. The problem appears immediatly on include (I deleted the code that calls the function to test it). I think it is because I am using imagejpg(); function which outputs to the browser but I don't know how to change this.
View Replies !
View Related
Compiling PHP With Freetype Fails
I have had a working PHP installation (4.3.1) on Redhat 8.0 with several extensions (including GD) that have been working well. Now I needed to add Freetype, because we'll need to use font manipulations with GD. So I tried to install Freetype 1.3, but the "make" gave me compilation errors. I then forgot about it and installed Freetype 2, without any problems. So I reconfigure php, no problems. My ./configure line is (new options from the last build are in bold): Code:
View Replies !
View Related
Header() Sometimes Fails, Sometimes Works, Same Url
<? header('Pragma: no-cache');// ENSURE CLIENT-SIDE CACHE FLUSHING $url = "$projectURLPath/index.php"; if ($_REQUEST['logoutMsg']) $url .= '?logoutMsg='. urlencode($_REQUEST['logoutMsg']); if ($willAuthenticate && $willUseSSL) { $dest = 'https://' . $_SERVER['SERVER_NAME'] . $url; } elseif ($willBasicAuthenticate && $willUseSSL) { $dest = 'https://EnterYourUserName:EnterPassword@' . $_SERVER['SERVER_NAME'] . $url; } elseif ($willAuthenticate) { $dest = 'http://' . $_SERVER['SERVER_NAME'] . $url; } elseif ($willBasicAuthenticate) { $dest = 'http://EnterYourUserName:EnterPassword@' . $_SERVER['SERVER_NAME'] . $url; } header("Location: $dest");// DEFAULT REDIRECT TO MAIN PAGE exit(); ?> This code scriptlet will allow for redirection to dynamically relocate to another URL. However, for some bizarre reason, it will not redirect anywhere; it just dies (no warnings, no errors, no notices, no nothing!), however, if you refresh your browser, the redirected page appears, sometimes after 1, 2, 3 tries. Then sometimes it redirects with no problems at all. I tried closing my browser, logging out, refreshing everything, deleting cache/history.. to no avail.
View Replies !
View Related
PHP Mail() Function Fails
I have a PHP script which has been working flawlessly (and quickly) on a UNIX server for months. Now, I need to port it to a Windows server because I need to be able to read a dbase files, using the php.ini configuration: Code: extension=php_dbase.dll (This is a windows only configuration) However, now that the script is running on a Windows Server, the mail() function creates errors. Basically, the program executes a query on three MySQL tables (Left Join) then calculates some criteria and generates different e-mails for about 350 customers. The e-mails are sent using the following PHP command: PHP Code:
View Replies !
View Related
Logging Out Of PhpMyAdmin 2.8.0.2 Fails
Environment: phpMyAdmin 2.8.0.2 PHP 4.3.11 Unix (FreeBSD) MySQL 4.0.16 I was able to successfully install phpMyAdmin and set config.inc.php to do "http" based authentication. I am able to log in with no problem. However, upon clicking the "Log out" link provided, once I get the authentication window to re-login again, if I hit "Cancel".. I'm still logged in! If this a "feature" in phpMyAdmin or what did I do wrong?
View Replies !
View Related
PHP File Upload Fails
I am trying to do a FTP file upload which works fine on my localhost but on my ISP server it fails. I can't seem to find where I can go to find the specific cause of the failure. In both cases the file is being transmitted to the same FTP server and using the same PHP script so it shouldn't be a file size or login credentials problem. Could someone please help me out and give me some ideas what is wrong. I would really appreciate any help someone could provide as I've spent many hours on this looking for answers. I've contacted my ISP and they've looked at everything and also do not have an answer. Here is the PHP form and script I'm using: Form: <form enctype="multipart/form-data" action="fileupload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> Choose a file to upload: <input name="uploadedfile" size="60" type="file" /> <input type="submit" name="continue" value="Continue" /> </form> PHP: // set up basic connection $ftp_server = "ftp.showmyhorse.com"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name = "XXX"; $ftp_user_pass = "XXX"; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { $_SESSION['message_new']= "Attempted to connect to $ftp_server for user $ftp_user_name has failed! "; break; } else { //echo "Connected to $ftp_server, for user $ftp_user_name"; } // upload the file $source_file = $_POST["uploadedfile"]; $basename = preg_replace( '/^.+[\/]/', '', $source_file ); $filename = preg_replace( "/[^w.-]+/", "_", $basename ); $ShowID = $_SESSION['ShowID']; $destination_file = $ShowID . "_" . $filename; echo "source_file: $source_file <br>"; echo "filename : $filename <br>"; echo "destination_file: $destination_file<br>"; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { $_SESSION['message_new']= "FTP upload has failed; Contact
View Replies !
View Related
Mysql_query() Fails On First Semicolon (;)
I have a SQL Script with about 5000 SQL Commands. How can I send it to SQL Server at once? I see mysql_query() fails on first semicolon (;) who delimits the SQL Commands. Another question: I send to a MySQL server via fast Internet connection, about 500 INSERT commands one by one via mysql_query(). It takes much time. Why? I suspect that, mysql_query() after send the query to server, waits for a "OK" response. If it's true, how can I send and send and send SQL commands and MySQL server reply "OK" after send all these things? (or no wait at all?)
View Replies !
View Related
Fopen For Write Fails
I'm having trouble opening a file for writing under Red Hat Fedora Linux. Here is the statement: $fp = fopen("/var/www/html/test01.txt","w"); It generates the following error msg: fopen(/var/www/html/test01.txt): failed to open stream: Permission denied in /var/www/html/buildhw.php on line 11 Here are the permission settings for the directories and the file that I'm trying to open: drwxrwxrwx 25 root root 4096 Aug 13 12:57 var drwxrwxrwx 11 root root 4096 Aug 13 13:12 www drwxrwxrwx 2 root root 4096 Dec 26 13:19 html -rwxrwxrwx 1 mike mike 22 Dec 26 13:17 test01.txt Here is some more info: 1. Logging in as root makes no difference - still get the same error. 2. If I change the mode from "w" to "r", fopen works. This tells me that PHP can at least find the file. 3. I can do an fopen on the same file from C, with a mode of "w", and it works. This implies that it's not a permission issue, but rather something in PHP or Apache. 4. The account named "apache" is a member of the groups "mike" and "root".
View Replies !
View Related
Htaccess Fails On Proxy?
I log in a directory protected by .htaccess and after I log in, I close all windows. So I retype the address for the directory in the browser address bar and it allows me to reenter the directory without ask for login and password. When I open a window even in a computer beside mine it allows reenter the directory. Why does it happen?
View Replies !
View Related
Xml_parse_into_struct() Fails On All Forms Of RSS?
I did a little test to learn about how xml_parse_into_struct() works and I find, to my surprise, that it fails to work at all with two different versions of RSS. But it works with an Atom feed just fine. Go look at this page: You can see the output here: You'll note that the where the print_r() is, the Atom feed is turned into an array, but both versions of RSS that I'm testing here come up completely empty.
View Replies !
View Related
PEAR Installation Fails With 5.2.0 On Win XP
PEAR installation failed with PHP 5.2.0 on Windows XP. The reported error is mismatch between array types. Did anyone else come across that? Any solutions? I didn't have any problems with Linux: $ php --version PHP 5.2.0 (cli) (built: Nov 3 2006 21:13:54) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies $ pear list Installed packages, channel pear.php.net: ========================================= Package Version State Archive_Tar 1.3.1 stable Config 1.10.7 stable Console_Getargs 1.3.2 stable Console_Getopt 1.2 stable DB 1.7.6 stable Date 1.4.6 stable HTML_Common 1.2.3 stable HTML_Form 1.3.0 stable HTML_Table 1.7.4 stable Log 1.9.9 stable MDB2 2.3.0 stable MDB2_Driver_oci8 1.3.0 stable PEAR 1.4.11 stable PHP_Beautifier 0.1.11 beta Var_Dump 1.0.3 stable XML_Parser 1.2.7 stable XML_RPC 1.5.1 stable XML_Util 1.1.1 stable
View Replies !
View Related
Js File Fails With Session_start()
i've had this problem and i've had this problem before. IE fails to accept cookies when a js file is being loaded from a tag and i think it causes similar problems with flash files loading movies too. The cookies are sent to php properly and i can access the session id form the file but as soon as i use session start it tries to extend the session cookie life i think which causes ie to die. I've searched the php site and the net for a way to use a session id to activate a session without it sending a cookie for this one page only but i cannot. I would prefer to use the cookie session method.
View Replies !
View Related
|