PHP - Linux/php Vs Windows/php
Hi all,
I like to write scripts for my Aastra IP phone. 480i. I have done all my scripts with Apache on windows. I thought I would try it on Linux with the AsteriskNOW FreePBX 1.4 load. Phone system software for those that do not know. So my code is below something very simple to display on the screen. Ignore the $textmenu code that works fine. The problem is it does not open a file and do something then write the file. On my Windows / Apache box the screen will display on the phone and open the file and do whatever. On my Linux box it will display the screen fine but will not open that file. Why would it be ingnoreing those PHP file commands? Any ideas? It file commands work if I run it with php script.php but not when I use my phone to launch that script. Now keep in mind Windows/Apache is fine no problem. I thought maybe it was a php.ini setting on the linux box? <?php $textmenu = "<AastraIPPhoneTextMenu style = \"numbered\">\n"; $textmenu .= "<Title>------- Test -------</Title>\n"; $textmenu .= "<MenuItem>\n"; $textmenu .= "<Prompt>Applications</Prompt>\n"; $textmenu .= "<URI>http://65.205.71.13/xml/menu/menu.php?source=all</URI>\n"; $textmenu .= "</MenuItem>\n"; $textmenu .= "<SoftKey index = \"1\">\n"; $textmenu .= "<Label>Select</Label>\n"; $textmenu .= "<URI>SoftKey:Select</URI>\n"; $textmenu .= "</SoftKey>\n"; $textmenu .= "<SoftKey index = \"6\">\n"; $textmenu .= "<Label>Exit</Label>\n"; $textmenu .= "<URI>SoftKey:Exit</URI>\n"; $textmenu .= "</SoftKey>\n"; $textmenu .= "</AastraIPPhoneTextMenu>\n"; echo $textmenu; $fp=fopen("/var/www/html/aastra/awa-det/conference/test.txt","w+"); fwrite($fp); fclose($fp); ?> Similar TutorialsMy IDE (Nusphere's PhpED) runs on Windows but is configured so that both the web server as well as all project files are located on a development Linux server. Since the project files are located on the Linux server, the git repository is located there as well and not on my PC. Every now again, my IDE complains that content was externally modified and whether I wish to reload the file. Also, I was recently asked to set git's core.autocrlf to true on a project I was collaborating on which prevented me from adding any changes to git (git complained that LF will be replaced by CRLF). The IDE allows file encoding to be changed (system default, UTF-8, Windows-1252, or ISO-8859-01) as well as the default file format (Unix, Windows, Mac, or autodetect). Any recommendations on how best to configure git and these ide settings? Thanks I need to copy php files from remote linux (apache) server to windows usb drive.
I am using php windows but the files were created in php under linux.
Do I just download them or do I need to do something to make this work
Hi, I'm not totally sure if this is the right section for this question but... I have my dev environment (my laptop) - windows vista, apache web server, also using my laptop as a client. I have my php project on the web server, I go to the login page in my browser (IE8) and login in, if it's valid it reloads the page with the user detail etc..it works. I've moved it onto a linux server (i think it still uses apache), I go to the login page in my browser (IE8) and login in. A blank page is displayed BUT if i hit refresh the user detail is displayed as expected. Also if I logout, again a blank page (it should display the login page) but when I hit refresh this time, it stays blank. I won't post my code just yet as I was wondering if anyone ever had the same issue before? Windows..works ok, Linux..doesn't work ok till refresh, but even then that doesn't work for the logout. My other thought is that it may work ok in windows because everythings on my laptop as in c:/php and the web server. Not much to go on I know but it may ring a bell with someone. thanks Hi, I have the following code: Code: [Select] <? Header("content-type: application/x-javascript"); function returnimages($dirname="./windows/prezentare_jpg/") { $files = array(); $curimage=0; if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))){ if(preg_match('/.jpg$/i', $file)){ echo 'galleryarray['.$curimage.']="'.$file .'";'; $curimage++; } } closedir($handle); } return($files); } echo 'var galleryarray=new Array();'; returnimages(); ?> Ran on windows (xampp 1.7.7, PHP 5.3.8, Apache 2.2.21) it returns the correct alfabetical/numerical order: Code: [Select] var galleryarray=new Array();galleryarray[0]="01.jpg";galleryarray[1]="02.jpg";galleryarray[2]="03.jpg";galleryarray[3]="04.jpg";galleryarray[4]="05.jpg";galleryarray[5]="06.jpg";galleryarray[6]="07.jpg";galleryarray[7]="08.jpg";galleryarray[8]="09.jpg";galleryarray[9]="10.jpg";galleryarray[10]="11.jpg";galleryarray[11]="12.jpg"; Ran on linux (PHP 5.3.8, Apache 2.2.21) it returns an incorrect order: Code: [Select] var galleryarray=new Array();galleryarray[0]="06.jpg";galleryarray[1]="01.jpg";galleryarray[2]="08.jpg";galleryarray[3]="10.jpg";galleryarray[4]="04.jpg";galleryarray[5]="11.jpg";galleryarray[6]="05.jpg";galleryarray[7]="03.jpg";galleryarray[8]="07.jpg";galleryarray[9]="09.jpg";galleryarray[10]="02.jpg";galleryarray[11]="12.jpg"; I need the script to run correctly on the linux server. What could be the problem? What can i try? Is anyone running PHP storm on Windows and debugging their PHP code on a remote Linux box? I ask because I am contemplating buying PHPStorm. What opinions I have read on this configuration say it doesn't work well. this issue is not about core php hacking, but I guess this topic fits here best. I want to make php mail() function send emails using remote smtp server. I want to force this to all mail() users at my servers. However I use linux php so I cant specify remote smtp in php.ini cause php passes emails directly to sendmail/qmail ... (ps. I dont need script to use with remote smtp by socket connections, i want to make MAIL() do it so my users dont have to change anything at their source). So what I need is a) MTA like sendmail that actualy dont send mails to repicients, but it transfers it to remote mta-smtp (ps. I dont want relay, cause I dont want relaing to be visible in source of message) or b) some core hack-mod to make php mail() with php.ini work like on windows - not with sendmail/qmail but with socket connection to smtp. Any ideas.. I guess not I use my desktop (Windows) to make websites and then once it's completed transfer to my Linux server but I've come across a weird issue. On Windows the file location is like this: C:\Server\Apache\htdocs\RSCEmulation On Linux the file location is like this: /home/rscemulation/public_html Now in those folders I have a folder called 'include', in that I have 2 files: header.php, functions.php In the base folder I have index.php. I then include header.php by using: include "include/header.php"; Then I include functions.php (from header.php) by using: include "functions.php"; Now on Linux this chucks an error, even with "./functions.php" -- I have to use include "include/functions.php" even though I'm already in that directory from the file I'm calling it from, although admittedly the file is being included from the directory below but this works fine on Windows with a base PHP install. This Linux box was given to me and I'm not sure if any PHP settings have been changed or not. I also have a config.php that I keep below the public directory (htdocs or public_html) but it won't let me include it on the Linux server by using "../../config.php" (I've tried all levels ranging from 0-5 with no luck) Can anyone shed some light on this please? I need it to work the same both on the Windows and Linux boxes as I copy and paste the files regularly and it's annoying changing them! Cheers. Hello, The following is my situation where I seem to get a 500 error code from the linux server: i have an 'index' file like this: Code: [Select] <?php require("includes/config.php"); $a = $_REQUEST['a']; switch ($a) { case "home": include("frontpage/main.php"); case "user-process": include("user-process.php"); } ?> config.php is something like this: Code: [Select] <?php require(includes/classes/session.class.php); require(includes/classes/user.class.php); require(includes/classes/db.class.php); ... ?> Now if we fall into the case "home" it works fine. Instead, if we fall into user-process it writes to the logs file Fatal Error: Class User does not exist bla bla bla. Why doesn't it exist ? every class is included in the config.php file then index.php includes first config.php ( which has all the classes) and then includes the requested page. I also have a .htaccess file which is as follows: Code: [Select] RewriteEngine On RewriteRule ^([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?$ index.php?a=$1&b=$2&c=$3&d=$4&e=$5&f=$6&g=$7 [NC,L] which is used to access in a SEO friendly way the pages that users request. Hello, I'm working with Zend Framework on Linux, and I'm trying to generate a CAPTCHA using Zend_Form_Element_Captcha. Whenever the CAPTCHA page loads I get this error: [12-Jan-2011 18:14:54] PHP Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Unable to open '/var/www/square/application/../public/captcha/ebf44d292149b3ebda05571c54c463a8.png' for writing: Permission denied in /usr/local/zend/share/ZendFramework/library/Zend/Captcha/Image.php on line 563 Here's my code for generating the CAPTCHA: // create captcha $captcha = new Zend_Form_Element_Captcha('captcha', array( 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'width' => 300, 'height' => 100, 'imgUrl' => '/captcha', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'font' => APPLICATION_PATH . '/../public/fonts/LiberationSansRegular.ttf', ) )); I've checked permissions, and all directories mentioned above are accessible to root. Has anyone had a similar problem or have an idea how I can fix this? Kind Regards, Mike Hi Guys I am struggling with a shell_exec command in the long run, but I am trying to work down the root cause. The error I am getting with shell_exec is a file not found error, so I thought I would start with getting to the right folder. I have this Code: [Select] $sym_dir = "/root/"; $cwd = getcwd(); echo getcwd()."\n"; chdir ($sym_dir); echo getcwd()."\n"; Which in theory should 1st display '/var/www' as it does and then display the contents of root, at least that is my understanding! However my return is this /var/www /var/www Why cannot I move outside the web root? Cheers Dave Hello, Can I set the priority on my scripts relating to swap? Something like set_swap(10); would mean that it will be first to go into swap and set_swap(1) means it will go as a last resort and set_swap(5) being the default ? Kind of like the proc_nice() but for memory ? Thanks, David I am using shared hosting at HostGator. I am trying to execute flare (a command line actionscript decompiler) via PHP. According to phpinfo() my System is Linux gator1854.hostgator.com 3.2.13 #4 SMP Thu Mar 29 19:22:42 CDT 2012 x86_64 In my public_html, I have a folder named "zachafer" and inside that folder, I have a folder named "flare". Inside the flare folder, I have the flare command line version, named "flare" and a file named movie.swf. The flare website says that I need to run "./flare somepath/somename.swf" Here is my code: <?PHP error_reporting(-1); $swf = 'movie'; chdir("/home/infamous/public_html/zachafer/flare"); $cmd = "./flare $swf.swf"; shell_exec($cmd); echo "Cmd: $cmd\n"; echo "File: ".file_get_contents("$swf.flr"); ?> Thank you. Sorry for posting this here, but for some reason the "create new topic" in linux subforum doesnt exist. anyways i made a small php script that enables me to retrieve data between two dates. now am stuck on how i should copy it or u0pload it into linux. system tells me i need to upload to /usr/bin/libexec , i am there now but i dont have the slightest idea on how to do that. help is much appreciated. Thanks I am new to Php and the linux environment. I have written a php program which sames a file to folder using xampp in Windows but I am having a problem with the pathway using my Ubuntu server and LAMP. My code I used in Windows was: $fileName = "guessbook.txt"; $file = fopen ($fileName, "ab"); if(!$file) { echo "ERROR! did not create the file! Exiting.<br />; exit(); } This file was saved correctly using xampp into the htdoc folder and worked fine when I called it in my browser. I tried to substitute a Linux pathway ie: /var/www/assignment2/guessbook.txt, where guessbook is in the code but still nothing. Can someone explain how to write the correct pathway to save this file? Thank you Paul Hi,
Please I keep seeing this on my wordpress website Linux+cfcd208495d565ef66e7dff9f98764da+01+[[]].
I've tried to clear it out but to no avail. Does anyone has a solution? I will appreciate.
Thanks
This topic has been moved to Installation on Linux. http://www.phpfreaks.com/forums/index.php?topic=321601.0 Hi, I am trying to use php to pass some commands to my linux box.From my webpage I am using the shell_exec function which is working OK but for some administrative tasks in linux I must have root access. As I am sending the commands from the webpage the apache user is used and so I am not allowed to do several tasks. I have also tried to use a bash script to pass the commands but with no result. Any ideas ? What are your feelings regarding Linux desktop distros, and their ability to break through to mainstream usage? I started using Ubuntu about 6 or 7 years ago, and have fooled around with some other distros, but at least for me Ubuntu always seemed the best. I've got my 65 year old mom using it, and my 11 year old son playing with Kubuntu (and learning python!). I don't really consider us normal though; normal being almost too dumb to do more than check email and get on the internet.
I've managed to fully switch over to Ubuntu on all of my computers, with the exception of running Windows in a VM for Photoshop and Illustrator. Since I don't use those programs every day, there are a lot of days where I don't see Windows. I never really had a problem with Windows, except for Windows 3.1 was kind of a drag. Getting on the internet on a 56K modem on Windows 95 wasn't any fun either, but that wasn't Windows' fault. I never had the crashes and bad experiences people like to claim makes Windows suck. My main reason for abandoning Windows is just to be more involved with Linux, and hopefully reach Linux guru status someday.
I really never liked Macs. I bought one 3 or 4 years ago, and it just felt like I was paying a lot of money for a glorified (and over-hyped) linux distro. I really never liked the feel of the Finder. At the time there was no awesome text editor, and I bought a couple just to test out what I could find. Unlike Windows and Linux, it seemed like nothing is free in the Mac world. I eventually gave the Mac away. We couldn't be friends.
I'd really like to see Linux become the dominant OS. It's exciting to see how far Ubuntu has come in the years that I've used it, and I evangelize for Linux/Ubuntu quite a bit. Even still, it can sometimes seem that I am a stranger in a strange world. Do you think we can count on Linux being a bigger part of mainstream computing? One of the problems I see is that there are so many distros that a person investigating Linux may be a little overwhelmed. What do you think is keeping the masses from using Linux desktops?
So I just started watching the videos from Stanford, Google, MIT and a few on youtube. One of them contained the code for using tkinter function to create an application window and I tried to put the same type of thing together can anyone tell me what I am doing wrong cause nothing is happeing for me. I am running linux mint:
# - So this is what it feels like # - To be alive #!/user/bin/python import sys author = "Brian T. Flores" version = "0.1" sessionID = 0 #Get Interface from Tkinter import * #initialize interface root = Tk() #modify root window info root.title("Unknown Limits - Massive Multiplayer RPG") root.geometry("200x100") #initialize root window root.mainloop() #if session is > 0: #Get Player Info UserName = "Brian Flores" Password = "enterprise" rank = 32 #planetOverview planetName = "Earth" plasmaOnhand = 1000000000 titainiumOnhand = 340000 crystalOnhand = 55000000 magneticEnergyOnhand = 350000 ecosystem = "No" # yes or no depending on wars or natural disasters that could have damaged or destroyed your ecosystem if there is no ecosystem the atmosphere must be cleaned up and another must be transplanted from another world. ecosystemDamage = 10000; #Damage can result from experiments, wars, natural disasters. At 10,000 damage the ecosystem goes extinct. You can repair this damage my researching technologies and building machines to do such repair # else: # print "You are not logged in!"; # raw_input()Well for some reason it's not working. All I am doing here is setting some vars and using the root.tk function. If anyone has any Ideas or tips to get this basic script working let me know. Thank you, DaRedHead Edited by DaRedHead, 21 November 2014 - 09:17 PM. hello guys. i ve been trying to write to a file using fwrite() inside my server directory. i am using this code: Code: [Select] ini_set('error_reporting', 'on'); error_reporting(E_ALL); echo substr(sprintf('%o', fileperms('skata')), -4); $fp = fopen("skata", "w"); fwrite($fp, "skata"); fclose($fp); the only thing that comes up to the browser is: Code: [Select] 0777 i have even pre-created the file "skata" in the diractory running as root and gave it permissions 777. i m not quite familiar with linux or apache permissions and i can tfigure out what's going wrong. i am running apache under fedora, and i would appreciate some guidelines here. |