PHP - Linux Swap And Php Scripts
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 Similar TutorialsHi 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); ?> 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. This topic has been moved to Installation on Linux. http://www.phpfreaks.com/forums/index.php?topic=321601.0 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 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
My 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 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?
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 ? 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 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 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 Hi, Happy Christmas I got a error in my php file only when am running in linux server $handle = fopen("bak\\".'db-backup-'."$date_time".'.sql','w+'); fwrite($handle,$return); I am trying to write the content in the bak folder, but it fails, its showing the following error. Warning: fopen(bak\db-backup-25-12-2010-06-53.sql) [function.fopen]: failed to open stream: Permission denied in /home/cmstouch/public_html/cmstouch_demo/touchPanel/global.php on line 404 Warning: fwrite(): supplied argument is not a valid stream resource in /home/cmstouch/public_html/cmstouch_demo/touchPanel/global.php on line 405 Thanks Does anyone know how I can convert linux epoch number such as 1292878800 to the UTC format? Ricky Hi guys, I'm trying to run a php script from command line in linux. I installed xampp for linux a.k.a lampp so typing php /path/to/file.php Just brings up a message saying I need to install php. Whats the correct way to do this? 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 ant to install linux on a notebook (which i want to buy ) The notebook: hewlett packard - hp 14r103ng notebook with 4 (8GB) Prozessor: Intel® Pentium™-Prozessor N3540 (4x 2,16 GHz, mit Turbo Burst bis zu 2,66 GHz, 2MB Cache) Grafik: Intel HD Graphics RAM 4 GB DDRL3 1600 MHz, max. 8 GB drive: 500 GB, 5.400 U/Min, SATA, 2,5“ what do you think bout this idea. Question: i do not do play games. I only need the notebook to have a good one for being mobile. I plan to set the RAM to 8 GB immitiately after buying it. do you think that this is a good choice or do you suggest to go to a notebook that has a INTEL i 3 or INTEL i 5 processor again: i only need a notebook that does basic things... The notebook costs 260 to 290 Euro in Germany - thats a fair price - reasonable and okay i think. The notebook has got a dvd-drive... love to hear from you Hello Community, good evening! i am having troubles with starting PHP on linux - [running OpenSuse-Linux] Could not open input file: - suse-linux:/usr/perl # php -v PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/extensions/readline.so' - libedit.so.0: cannot open shared object file: No such file or directory in Unknown on line 0 PHP 5.3.4-dev (cli) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies suse-linux:/usr/perl # well what is wrong here...? hello dear php-freaks and -experts i just installed putty on linux - how to start it now? love to hear from you Edited by Maze, 27 November 2014 - 03:37 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. |