Tag Info

Hot answers tagged

7

The most common reason why a script works from the command line but not from a crontab is that the script depends on an environment variable. Crontabs only have a few environment variables set: typically only HOME, USER, SHELL (set to /bin/sh) and PATH (set to a system default). If you need more, you must define them in the crontab file, or source ~/.profile ...


6

Of course any services you have open will increase your vulnerable attack surface. What runs behind those services will determine how secure and insecure you become. If you write insecure PHP scripts and host them in your newly accessible Apache site, the world will be able to (and will!) exploit them. You should seriously consider what you are making ...


6

Use the Dotdeb Debian stable packages. Although the documentation does not note this, the stable packages currently work fine with Wheezy/testing. After following the instructions, do: apt-get install php5-cli as root.


6

sudo apt-get remove php5-cli sudo apt-get install php5-cli And the one liner, sudo apt-get install --reinstall php5-cli


6

So if I understand things correctly, if apache is running as www-data and I want apache to be able to read a directory, the x bit needs to be set for the world (other) group (o+x), and that also needs to be set on all parent directories all the way up the chain (www, var). And if I want apache to be able to read from a file, then the o+r bit ...


6

not root not root SuEXEC Depends. 644 for files and 755 for folders are a safeish default. Don't change ownership of anything to www-data unless you want php to be able to edit the contents of that file/folder Irrespective of anything else you do: folders need read and execute permissions for the user to find files; files need read permissions for the ...


6

PHP is probably trying to talk to a local SMTP server, that is, one running on the same machine as the web server. So, have you set one up? There are many to choose from. The most popular are Sendmail, Exim, Postfix, and Qmail. Try sending email using the primitive mailx client. If it can't send mail outside the machine, it's probably for the same reason ...


6

You can use the command line switch -m to php to see what modules are installed. $ php -m | head [PHP Modules] bz2 calendar ctype curl date dbase dom exif fileinfo ... You could also use php -i to get phpinfo(); output via the command line which would include this info as well. References extension_loaded - PHP documentation


5

You forget to add handler for php script. Have you tried this wiki yet?


5

It's PHP, of course. Pipes wouldn't eat the first character of the file. PHP is reading all the characters, but it isn't outputting the first one. So far you cannot tell whether the problem is in the input or in the output: it could be that PHP is not outputting the first character for some reason. A little experiment shows that the problem is indeed with ...


4

You could take a look at webmin. Not sure that it allows fine-grained controls.


4

Modify your shell script to enter the php scripts directory before executing it, and then return back. cur=$(pwd) cd /var/www/html && php ./createview_customer.php cd "$cur" or better modify your php script to find its directory first and open the file in that dir $dirpath = dirname(__FILE__); $handle = fopen("$dirpath/available_data", "w");


4

Starting from the bottom: I don't think it matters. Well, it matters a little bit. CentOS uses RPM, but many other distributions don't. How you package things really depends on where you expect to install them. How do I turn it into an rpm? You need to create an RPM SPEC file, which is a collection of metadata about your package and the rules ...


4

Add shebang at the top of your code #!/usr/bin/php


4

Appears you have both suEXEC and SELinux enabled, so you will need to hack around to permit execution of the php script, to start off check CGI scripts are permitted: getsebool -a | egrep 'cgi|builtin_scriptin' If not: setsebool -P httpd_enable_cgi 1 setsebool -P httpd_builtin_scripting 1 Also check the php scripts have the necessary extended flag, ...


4

From the question and from the output, it seems that you only have the RPMForge repo enabled and nothing more. /etc/yum.repos.d/rpmforge.repo:name = Red Hat Enterprise $releasever - RPMforge.net - dag /etc/yum.repos.d/rpmforge.repo:enabled = 1 So run: # yum repolist disabled repo id repo name ...


4

With distros such as RHEL and CentOS, they typically have a 7-10 year lifetime, it's difficult to keep them up to date with the latest versions of things. Your only options are to: go without it build it from source yourself use a 3rd party repository that provides alternative packages I typically go with #3. You can use this repo to install 5.5: ...


4

As @artfulrobot pointed out in his comment, 5.4.35-0+deb7u2 was released, which fixes the issue. After installing it, everything went back to normal.


3

You have accidentally changed /bin/readlink to be busybox, rather than the GNU coreutils version. This will cause a LOT of breakage. You need to restore GNU coreutils. Try # aptitude reinstall coreutils


3

I think you need to wrap your code in <?php ... ?>. Try this file: <?php phpinfo(); ?> By default, the contents of a PHP file are HTML that is sent untouched out to the browser. The markers <?php and ?> mark the start and end of PHP code that is interpreted by PHP.


3

As an addition to the answer by Gilles who suggest recompiling the complete PHP package you can also wait for PHP 5.4. In 5.4 I restructured the realdine functionality that all required parts are in the readline module, so you can built that stand alone. $ wget ...php-5.4.0.tar.bz2 $ tar xjf php-5.4.0.tar.bz2 $ cd php-5.4.0/ext/readline $ phpize && ...


3

Try this: $ php -a Interactive mode enabled <?php echo "hi!"; ?> The press Ctrl-d


3

A quick google search returns a similar question at stackoverflow.


3

You can look at the return code from the ssh command. If the command fails, ssh will return a non-zero exit code. According to the PHP documentation, the system and exec functions both allow you to capture the return code of a command in the *return_var* parameter.


3

Instead of, or in addition to, writing to a database, have you considered writing to a named pipe? You could create one named pipe per user and then create a process to watch each named pipe. When the 'restart' command comes, immediately restart the process. This is not a complete solution and can be improved upon, but it should give you an idea of how you ...


3

One of the standard ways of doing this is to download the php source code from http://php.net/downloads.php and compile it with ./configure --prefix=/opt/php/5.3.15 or something to that effect. Then, your new php will not conflict with any system packages. Note that on Fedora, you will need to install a bunch of -devel packages to build php with the ...


3

What about official way? yum update php php-* -y Never ever mess up system with downloading tar/gz while official package exists. Also look here : http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-5.3-lamp Be sure to restart apache after upgrade : service httpd restart


3

PHP uses the dotted integer convention for versions (i.e. the version number should be considered a sequence of integers, not a floating point number). 5.3.10 was the release after 5.3.9. That means 5.3.18 is sixteen releases after 5.3.2. Note that this is the standard way of interpreting a version number with more than one dot in it. Single-dotted ...


3

Or just execute php parser with script as an argument 30 0 * * * /usr/bin/php /var/www/vhost/mydomain.com/httpdocs/backupfile/dobackup.php


3

Not exactly answering your question (h3rrmiller gave you a good answer already), but I would suggest not doing this. This will break all your mysql connections when your ssh connection dies, and they can only be reestablished when you set up a new ssh connection. If you're doing this to encrypt the mysql traffic: mysql supports SSL for connections too, ...



Only top voted, non community-wiki answers of a minimum length are eligible