Shell_exec On LightTPD

Sep 30, 2007

I've got a very simple script with shell_exec that's giving me a headache! My server is a NetBSD machine running LightTPD (1.4.8nb1) and php (5.1.1nb2).

I've got the file dummy.php with the following content:

$res = shell_exec("pwd 2>&1");
echo $res;

When I access this file through a browser i can't see any output:

http://my.url/dummy.php results in a blank page that loads in no time! No error messages, neither output by the browser or in the log files (php.log and LightTPD's error.log).

When I use the terminal on the servern it all works fine:

php /path/to/wwwroot/dummy.php gives me the working directory. Doesn't matter from which working directory I execute the command, or which user (I've tried the LightTPD user aswell). It works every time!

safe_mode is off and there are no disabled_functions!

I've asked around in LightTPD forums, but they say it's a PHP problem. So, I've asked around in (other) PHP forums but noone seems to have any ideas how to solve this!
Perhaps there are expert users here that can help me, or at least redirect me to some other expert forum.


Run From A PNG File On Lighttpd?

Aug 22, 2010

I only need to do this for one file (uptime.php) and it must be requested by using uptime.png.Adding a rule for all png files in my config file would be suicide

View 1 Replies View Related

Memcached Concurrency W/ Lighttpd?

Aug 14, 2009

I'm having an issue with memcached. Not sure if it's memcached, php, or tcp sockets but everytime I try a benchmark with 50 or more concurrency to a page with memcached, some of those request failed using apache ab. I get the (99) Cannot assign requested address error.

When I do a concurrency test of 5000 to a regular phpinfo() page. Everything is fine. No failed requests.

It seems like memcached cannot support high concurrency or am I missing something? I'm running memcached with the -c 5000 flag.

Server: (2) Quad Core Xeon 2.5Ghz, 64GB ram, 4TB Raid 10, 64bit OpenSUSE 11.1

View 3 Replies View Related

Caching Module For Lighttpd?

May 1, 2011

I'm using lighttpd web server and now I have to install wordpress to run my blog.

I am very concerned about caching. I know there is a good module for php named XCACHE but I don't understand if I have to install this module or only install "super cache" wordpress plugin.

What are the differences? Can run together?

View 1 Replies View Related

Iphone - Lighttpd Gets Error 500?

Mar 10, 2011

Whenever i try using php with lighttpd on my iphone i get error 500 when loading any php page including the phpinfo.php file.

View 2 Replies View Related

Enable Mod Rewrite In Lighttpd?

May 7, 2010

i need to enable mode rewrite in lighttpd it should no display the index.php extension ....

View 1 Replies View Related

Secure A Shared Lighttpd Setup?

Jul 6, 2010

(Yes, I know that questions pertaining to lighttpd fit better on SF, but I thought it was more apt to be asked here since it's primarily concerned with security policy.)We're planning to set up a small web server in my college, so that people could get some web space to put up web pages and the like. They could also upload PHP pages. The whole setup runs from within a chroot jail.We are thinking about using the same infrastructure to put up some more services, for instance a discussion forum. My problem is, putting the forum in the same document root (or indeed, the same chrooted environment) pretty much allows any user to place small PHP scripts in their directories that can access the forum configuration files (using, say, file_get_contents). This is a massive security risk! Is there any way to solve this issue, short of disabling PHP for the user accounts, and only keeping it enabled for the discussion forum and the like, or serve the forum elsewhere and proxy it using lighttpd?

View 2 Replies View Related

Running Rails On Lighttpd On Linux?

Feb 8, 2011

Well, I'm wondering if theres a way to run both rails and PHP on Lighty, on Ubuntu. I want to run both my PHP projects and Rails projects on the one server/domain.I have little experience with Linux really, so forgive my naivety.

View 3 Replies View Related

Opencart Redirects On Lighttpd 1.4.19-5+lenny2

Apr 27, 2011

Recently I've been looking into Opencart as a solution for simple E-commerce websites. I like it a lot, but I can't seem to get the redirection right.

I am using lighttpd as a web server, and I've noticed that Opencart offers Apache .htaccess configuration for SEO URL's, but no luck for lighttpd.

Opencart uses URLs that are formed like this:

Login Page: http://[domain]/index.php?route=account/login Product Page: http://[domain]/index.php?route=product/product&product_id=51

Ideally, I would like to have something like this:

Login Page: http://[domain]/index.php/account/login Product Page: http://[domain]/index.php/product/51/[product-name]

View 1 Replies View Related

Convert Apache .htaccess For Lighttpd?

May 6, 2011

I have installed the last version of Wordpress on my Lighttpd.

I'm using:

url.rewrite-once = (
"^/(wp-.+).*/?" => "$0",
"^/(sitemap.xml)" => "$0",
"^/(xmlrpc.php)" => "$0",
"^/keyword/([A-Za-z_0-9-]+)/?$" => "/index.php?keyword=$1",
"^/.*?(?.*)?$" => "/index.php$1"

is it good for you or do i have to use other rules?

The blog is running correctly at the moment, but I wouldn't degrade the performance...

View 1 Replies View Related

LIghttpd Create The Fastcgi Socket?

Apr 19, 2009

I'm working on setting this up on Mac OS X Leopard. I'm having a devil of a time getting PHP5 working as fastcgi under lighttpd. I've verified that I've compiled php with fastcgi enabled. I've tried configuring lighttpd as I've seen in various documentation. The core bit that I'm not understanding is if php-cgi is supposed to create the socket, or if lighttpd creates it.My lighttpd config looks like this:

fastcgi.server = ( ".php" =>

View 3 Replies View Related

Authentication - Protect A Directory In Lighttpd Using A Script?

Sep 26, 2009

I would like to protect a directory and authenticate users against a mysql database. I am using lighttpd and haven't been able to find a way of doing so.

View 1 Replies View Related

Configuring My Lighttpd Server To Support Of Python?

Apr 21, 2009

I've set up a few web servers in my day, but I'm not sure how they work internally. I'm setting up a new environment for myself and I'm interested in configuring my lighttpd server to support both PHP and Python. Is this possible?

View 2 Replies View Related

Mod Rewrite - Getting Rid Of Index.php In The URL When Using Recess Framework And Lighttpd

Apr 16, 2010

I am using the recess php framework with lighttpd

Does anyone know how I can use the shorter urls of:


Instead of:


The recess readme file says that if I have mod_rewrite I can use the shorter url:

-- "Do you have mod_rewrite?

-- Yes: Open your browser to the location you unzipped

-- No: Open your browser to the location you unzipped followed by index.php"

I do have mod_rewrite enabled on lighttpd and i have removed the index.php but I get a 404.

Do I need any special rules in my lighttpd.conf?

View 4 Replies View Related

Lighttpd With Php Fastcgi Send Output To Console Instead Of Browser?

Jun 20, 2011

I have a php script running as fastcgi server that executes browser-requested php files (why not use php/php-cgi? because of performance issue, we used APC too, but still not good enough):

# cat myphpcgi

View 2 Replies View Related

Apache Proxy To Lighttpd: Changing $_SERVER['HTTP_HOST']

May 10, 2010

I have a WordPress blog running on lighttpd-1.4.19, listening at www00:81. On the same host, apache-2.2.11 listens on port 80, which creates a proxy connection from [URL] to [URL] (both being the same physical machine). The Apache virtualhost looks as follows:

<VirtualHost *:80>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all

My problem: as far as I know, the PHP environment variable $_SERVER['HTTP_HOST'] is set to that Host header variable. Unfortunately, WordPress uses that variable in their system to create URLs to pictures on the blog. These URLs won't be accessible behind a firewall of course. How can I force the host header to be instead of, respectively www00:81? I already added set = "" to my lighttpd.conf, but this didn't work.

View 1 Replies View Related

Serving Downloads With Apache/lighttpd Authentication And Authorization Scheme?

Nov 28, 2010

I want to serve some confidential files to authenticated and authorized users. The PHP part is working well, and currently the PHP script outputs the file contents with the appropriate content types. However, some files are really large, thus, I'd like to have the HTTP Daemon to do the serving process and just "ask" PHP first if the user can get the file. How would I do this?

View 1 Replies View Related

Can't Connect To Local Mysql - Apache Error, Lighttpd Works?

Jul 19, 2010

I hope someone here can help me with this. I have spent days, search google, and all the questions about "Can't connection to local MySQL server though socket"I can tell you, that the mysql server is working fine. I'm using jmeter to do a test of 300 users to my server.
when I do a test for 150 users, I get no error, above that, then I get errors.

I have logged into mysql while I'm running the testing, to see if i can connect, and I can. I can also confirm that i'm using another machine and accessing the website, and it does show the web pages properly. I also do the same test, but with phpbb3 forum's software, and I get no errors with that... so I believe its the website that isn't done properly.


View 5 Replies View Related

Shell_exec Help Please

Jan 22, 2003

I have an ensim server which provides me with about 20 scripts in the filesystem that allows you to create sites, edit them, lookup domains, etc... I am running a few of these scripts from a cron I made and that all works fine but I can't seem to find a function (like shell_exec) that allows me to get the text returned from the function. When I run the script from CLI and i run the script using either system(), exec(), passthru(), or shell_exec() it just displays the results, and I didn't tell it to, it just does it on it's own bit. My question is how can i trap the results so I can anylize them.

View 4 Replies View Related

Ssh With Shell_exec

Jul 17, 2005

I'm trying to 'ssh' into another machine, run a small script and fetch
it's output, using shell_exec(). The problem is, it takes AGES to run
ssh and I don't know what's happening. If I try 'ssh'ing manually on the
shell, it takes a microsecond to fetch the result, whereas shell_exec
takes very very long and I don't know how to debug the problem. That's
problem number one: How do I tell what's happening and why is it taking
so long?

Problem two: To be able to establish a password-less ssh connection, I
generated a public key/private key pair for the two machines and stored
it in my /home/username/.ssh directory. Okay, I know apache/php (by the
way I'm running apache with PHP 4.2.3) won't know where to find it so I
presumed /opt/apache/.ssh would be the best place to copy the ".ssh"
directory (i.e. apache's installed in /opt/apache). Now the problem is,
I couldn't get shell_exec to run ssh in a password less mode. After a
little while I realized that it was looking for the private key in
"/.ssh" (i.e. the root directory)! How come? How do I change it so that
it looks for the .ssh directory elsewhere? (I mean, how can I run a
command using shell_exec and ask it to use the "home" directory of the
"apache" user, which normally is /path/to/apache)? The last time I
installed php & apache, I remember it looked for the .ssh directory in
the /opt/apache/.ssh directory and now it has changed. also, it was much
faster the last time. Now for some reason it's EXTREMELY slow (takes a
whole minute to run ssh) and looks for the .ssh directory on the root
(and I dont want to place that directory there).

View 1 Replies View Related

Cd With Shell_exec

Mar 7, 2006

I have the following script:

$c_path = "/absolute_path_to_some_directory";
$test_cmd = "cd $c_path; ls";
$test_res = shell_exec($test_cmd);

it always lists the contents of the directory where it is placed, rather than the contents of some_directory. In other words, it appears that cd is not working. I have verified that path and permissions are correct. PHP is version 4.3.9.

View 1 Replies View Related


Mar 1, 2007

I want to copy file from remote machine to local machine using PHP. On both machines Linux operating system present. The code is.

$result=shell_exec("scp admin@
conn /opt/lampp/htdocs/upload/");

View 3 Replies View Related

Get Shell_exec To Run On IIS 6.0?

Feb 19, 2010

I have a PHP script that uses shell_exec to run a pdf-to-text converter. To simplify the problem I've created a short script that uses shell_exec to just echo the output of the dir command.

$cmd = 'C:\WINDOWS\system32\cmd.exe /c ';
echo shell_exec($cmd.' dir');

When I run this on my Apache server, everything works as expected. When I switch to IIS, it's as though the line is skipped entirely: no errors, no output, no logs, no nothing.

Unfortunately, I need to use IIS because I'm going to authenticate my users against active directory.

Here's what I've tried so far:

Issue the command through cmd.exe /c rather than issuing it directly
Give Read & Execute permission to SERVICE on "C:WINDOWSsystem32cmd.exe"
Give Read & Execute permission to NETWORK SERVICE on "C:WINDOWSsystem32cmd.exe"
Give Read & Execute permission to IUSR_MACHINENAME on "C:WINDOWSsystem32cmd.exe"
Give Read & Execute permission to Everyone on "C:WINDOWSsystem32cmd.exe" (don't worry, it didn't stay like that for long, haha) Run PHP as an ASAPI module

This is my standard configuration

Run PHP as a CGI extention

This does not work, I get an error: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers.

In IIS Manager, set Execute Permissions to Scripts and Executables on your website
Added html markup and other php functions to script to see if that gets processed; it does. It's as if the shell_exec bit just gets skipped.

Update 1

I really didn't want to do this, but as a stop gap until I find a proper solution I'm running Apache on the web server (which runs shell_exec fine) and I call my apache script via cURL. It's ugly, but it works :).

Update 2

I'm beginning to think this isn't so much an issue with IIS or permissions as such, but perhaps a result of some policy we have on our network - although I can't imagine what.

View 6 Replies View Related

SSL Through Shell_exec

Sep 11, 2007

I've looked at the php documentation for openSSL, but found that the module seemed insufficient for purposes like checking a certificate's expiration date on another server. That is, I could not find a function to run "openssl s_client -connect", so I decided to instead achieve it through shell_exec.
This is a three step process:

1) Check the openssl version via shell_exec('openssl version -v'); just to confirm that openssl is installed and runs properly.
This returns "OpenSSL 0.9.7a Feb 19 2003 "

2) Connect to the remote server. As a test, I decided to use, since I know they use a certificate. shell_exec('openssl s_client -connect');

This pauses for about 20 seconds, and then returns FALSE. I've tried various combinations, like removing the -connect argument but leaving the server name in, removing the port, including the https:// part, removing the www, and so on. I have not tried a port other than 4433 yet (I wouldn't know what other part to use). All other methods returned FALSE immediately. This is the only method that delays 20 seconds, which indicates to me that I'm close.

3) Fetch certificate expiration date via shell_exec('openssl x509 -enddate'); although this obviously returns FALSE because I have not been able to connect to the server yet.

View 3 Replies View Related

To Install "mod_uploadprogress" In Lighttpd

May 20, 2011

I need to install "how to install" mod_uploadprogress "in lighttpd,

View 1 Replies View Related

Basic Shell_exec

Feb 14, 2003

I am trying to use shell_exec to do some scheduled clearing up but can't get it working.
PHP Code:

View 2 Replies View Related

Exec Or Shell_exec

Jun 23, 2006

I am trying to us shell_exec and keep getting an error. I do have safe_mode = off also.

if ($publish == "yes")
$command = "e:scriptspublish.bat";
$result=shell_exec($command); }

The publish.bat file does work and I have proper permissions set in windows, I set everyone full access. Oh, Windows server, IIS6.0, PHP. Error is as follows:

Warning: shell_exec() []: Unable to execute 'e:scriptspublish.bat' in

View 1 Replies View Related

Shell_exec Need Any Configuration?

Mar 10, 2006

Anyone can provide me information on how to did the configuration in the unix there to make the shell_exec() can work properly?

View 1 Replies View Related

Shell_exec - Cd Is Not Working

Mar 7, 2006

I have the following script:

$c_path = "/absolute_path_to_some_directory";
$test_cmd = "cd $c_path; ls";
$test_res = shell_exec($test_cmd);

Regardless of where I put the script, when executed, it always lists the contents of the
directory where it is placed, rather than the contents of the some_directory. In other words,it appears that cd is not working. I have verified that path and permissions are correct. PHP is version 4.3.9. What's wrong ?

View 1 Replies View Related

Shell_exec( ) Function

Mar 10, 2006

i trying to use shell_exec on a unix-type platform and can't seem to get it to work. Can anyone help me with the shell_exec command problem? below is the coding of my:


$output=shell_exec('ll -lart');

echo "$output";

suppose when i run this two line of php coding, there should be a output displayed. but no output displayed.

View 1 Replies View Related

Exec And Shell_exec

Nov 16, 2006

I'm new to running exec commands on php. I've had ffmpeg installed on my server, at /usr/local/bin/ffmpeg (a cmd line video decoder). It's a linux server, running php5.
From looking around the internet, I came up with this code to run it: Code:

View 2 Replies View Related

Shell_exec On The Localhost?

Sep 9, 2006

im expecting notepad to open up when I run the on the localhost???/ But its not


View 5 Replies View Related

Shell_exec And Variables

Mar 12, 2006

I'm trying to execute a shell command within a loop to fetch a filename that is stored in an array, but it's not substituting the array with the contents of the array. Here's what I have: Code:

View 1 Replies View Related

Shell_exec() Output

Sep 13, 2005

I am trying to get information from a shell on my server by using shell_exec() but the outputted data is not formatted and I cannot for the life of me figure out how to make the output appear how I want it. For example if I do a whois query I get the full output with returns so it is all dumped on 1 line.

Is there a way to make the outputted data appear the same as if I had performed the same query using SSH? Is there a way to make data from a traceroute appear line by line instead of waiting for the query to execute completly before dumping the data? I am assuming it can be done with Java but I am not sure.

View 1 Replies View Related

Output From Shell_exec

Jul 9, 2007

i'm having trouble with shell_exec. according to the output of the command is returned by shell_exec(), but this is not the case. i've tried exec,passthru and system but can't get the output into a variable. PHP Code:

$ffmpeg = escapeshellcmd('ffmpeg -i "'.$uploadPath['orgVideo'].$org.'"');
$tmp = shell_exec($ffmpeg);        
echo "

echo "

"; .....

View 2 Replies View Related

Shell_exec Not Working?

Jun 1, 2011

Is there any way to tell if shell_exec is actually doing anything? I have it working fine for simple things like cd and ls but when I tried to do something a little more complicated it doesn't look like it's doing anything. Here's one such command that's not working

$output = shell_exec('apktool d -f $file_name');
echo "<pre>Output :<br />$output</pre>";

apktool is something to reengineer android applications. The regular shell command I enter is identical to what I am putting into shell_exec but it isn't working. Additional things to note:I know php.ini has safe_mode off and it is not listed in disable_functions

View 11 Replies View Related

Specifying Paths Using Shell_exec

Sep 11, 2007

i use xampplite locally, winxp.

from PHP, this creates a blank mydump.sql file:

shell_exec("mysqldump --allow-keywords --opt -uroot mydb > mydump.sql");
but this works fine:

shell_exec("c:xampplitemysqlinmysqldump --allow-keywords --opt -uroot mydb > mydump.sql");

but if i use the second one on my pages, im afraid the code might not work anymore when i transfer the site to my server, because of the path. any suggestions???

View 1 Replies View Related

Errors Using Shell_exec?

Mar 2, 2010

I am running a script from the command line, and I am doing this:

Code: [Select]shell_exec('sh ~/processes/mini &');
When the "mini" file starts up, I get the following errors:[code].....

both files are exactly the same thing, only difference is filename, and they are both in the same directory.Why am I getting those errors?

View 2 Replies View Related

Shell_exec Not Working On Win2K3

Feb 3, 2006

We have PHP 4 installed on Windows 2003 with Apache 2, and the
shell_exec has mysteriously stopped working - it hangs the page rather
then returning anything.

To check it out, I tried shell_exec("dir") which works fine on the
development machine, but not on the live server.

I'm guessing the network guys have done something to the security of
the live server that would cause this - but it's very strange; why
would Apache (running under the default system account) not allow PHP
to run shell_exec statements?

I have checked PHP and it's not in safe mode.

I'm a bit stuck -

View 6 Replies View Related

Shell_exec Causing CGI ERROR

Jul 17, 2005

I have a php page that needs to call a batch script. My test script
has one line: echo test.

I am running Win2003 Server, IIS, and php 4.3.10.

When I first tried running my php script I got an error that said
"unable to execute ...". Then I granted the IIS user execute
privledges to cmd.exe (I know, I know ... security risk).

Once I did that, my script gives me a CGI ERROR - something about http

I've scoured google groups and come up with nothing that works. I
tried one solution that uses an executable called bgrun.exe. That exe
calls my batch script - still no luck. I've tried exec() and
shell_exec(). No difference. I've tried saving the result to a
variable and not. No difference.

View 2 Replies View Related

Shell_exec And

Dec 8, 2006

I have a perl script that I'm calling using php's shell_exec that uses
an expect module to go to another system to pull tiff files. The php
perl combination works great when I launch from the commandline:

$php docpull.php

I get the files I want. Everything is perfect.

When I run docpull.php through the web server I get to the expect call
in the perl script where the password is passed and the script fails.
No error in any of the logs or return from either php or perl.

I believe that its an environment issue regarding how php is run through
the web server and what the expect module from perl needs for a pty. I
think this is the case because I can see the scp command output that
perl expect is generating gets to the password but after that there is
no error. Expect needs to have a pty to work with and I think that when
I run through the command line I have one but when I run through apache
I lose access to ptys.

Permissions don't seem to be a problem because I've set up all of the
directories involved with uncomfortably open perms and I've run the
command line version as the Apache user.

I'm reaching at this point. Because of another server limitation I'm
stuck with php 4 and Apache 1.3 for the time being. If anyone has any
other suggestions for pulling files from a remote server I'd be happy to
give them a try, however, the scp with expect will solve lots of other
problems I'll have to deal with.

I'm on slackware linux 10.2

Apache/1.3.33 (Unix)

PHP 4.4.1 (cli) (built: Dec 21 2005 03:44:49)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with Xdebug v2.0.0beta5, Copyright (c) 2002, 2003, 2004, 2005, by
Derick Rethans

This is perl, v5.8.7 built for i486-linux

The expect module I'm using is Expect-1.20

View 1 Replies View Related

Problem: Exec() And Shell_exec()

Jul 17, 2005

I've got the following problem: exec() and shell_exec(), etc. don't give anything back, just the error code 127 For example, the following script:

exec("cat ./test", $lines, $result);

// or exec("./cat ./test", $lines, $result);
echo "result = $result<br>";
echo "Lines<br>
foreach ($lines as $k => $v) {
echo "k=$k v=$v<br>

View 5 Replies View Related

Alternatives To Shell_exec And Proc_open?

Apr 17, 2010

It seems like I can't use shell_exec or proc_open on my shared server.

The message I get when I try to use it is:

Warning: shell_exec() has been disabled for security reasons in /home/georgee/public_html/admin/email.php on line 4

Are there any alternatives to these functions?

View 3 Replies View Related

Shell_exec Without Waiting For The Output?

May 26, 2011

I want to run a quite slow / complex program which takes at least 10 minutes to complete. I want to call this via shell_exec or something similar, but I dont want the php script to wait for the completion of this thing something I can do? and if so how can I do that?

View 1 Replies View Related

Why Shell_exec Executing More Than 1 Process

Dec 21, 2009

I dont understand why there is more than 1 process when I run run.php once from a browser

In the PHP code, I have the following:

shell_exec("php theprocess.php > /dev/null 2>&1 &");


I execute run.php from the browser [URL] Then I typed: ps aux | grep php

username@ [~]# ps aux | grep php
username 27272 0.0 1.5 89504 64468 ? R 17:33 0:00 php theprocess.php
username 27274 0.0 1.2 89504 49872 ? R 17:33 0:00 php theprocess.php


I dont understand why is it showing more than 1 theprocess.php process? Also why it still running at the background? it should terminate theprocess.php finish the task.

View 7 Replies View Related