Removing a Cron - php

I've got a problem with a cron.
This is the line:
09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete
When this line works i'm taking a mail from my server:
PHP Warning: Module 'ionCube Loader' already loaded in Unknown on line 0
[Tue Nov 05 03:09:01 2013] [warn-phpd] The ionCube PHP Loader is disabled because of startup problems. (pid 32450)
When I remove the line related with ioncube from php.ini, site is not working. And when I remove the line from ioncube.ini ioncube doesn't work.
If I remove this job what happens? Any other solution?
I'm using Debian 6 x64, PHP Version 5.3.3-7
Thanks.

Your post suggests that you have referenced the Loader in two php.ini files, the main php.ini and a second one (ioncube.ini) located in an additional ini scan directory. The ionCube Loader must be installed only once, and ideally referenced in only one php.ini file.
Produce phpinfo() output from both the webserver and CLI PHP used by the cron job, and check to see if the referenced php.ini locations are the same. Also check that the PHP version is the same as sometimes it isn't due to PHP being updated incorrectly/incompletely on a server.
If the PHP version is the same and there is a common php.ini file being referenced, such as /usr/local/lib/php.ini, then that's the best place to place the zend_extension line for ionCube. You can use -c to specify the location of a php.ini file if needed.
If the PHP version is different, you must not use the same php.ini file that references the Loader as you need different Loaders. Use a different php.ini file for the CLI case and reference its location with -c. Consider fixing the installation to use the same PHP version for web and CLI though.
Probably not the case here, but if you have edited only one php.ini file to reference the Loader, it would suggest that the php.ini file is being read twice. This is a flaw in PHP and can happen if the main php.ini directory is also one of the additional scan directories.

Related

ionCube installation :: missing zend_extension CentOs

I am in middle of ionCube installation but php configuration is missing zend_extension for ionCube but not specify what is exactly
I am working on CentOs
All well Thanks:)
There were few things I have missed
Select the correct bit release
Match the Loader with your PHP version, e.g. for PHP 5.3, ioncube_loader_lin_5.3.so (extensions are inside the folder)
Add 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.3.so' to php.ini
Restart the server
There are 2 parts to the solution that worked for me:
symlink the 00-ioncube.ini file into the conf.d directory from the mods-available directory. Do not simply copy the file into the conf.d as the loader-wizard suggests.
Restart the fastcgi daemon off and on as well as the apache daemon
See my blog post for more details.
I had the exact same problem with installing on Ubuntu. Ubuntu wants a soft link from /etc/php5/apache2/conf.d/20-ioncube.ini to /etc/php5/mods-available/20-ioncube.ini. I tried THAT after following the directions given and apache restart failed with this error: "PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0" in the error log /var/log/apache2/error.log
The solution that worked for me was to delete the soft link and to add the line from /etc/php5/mods-available/20-ioncube.ini ("zend_extension=/usr/lib/php5/20121212/ioncube_loader_lin_5.5.so") to /etc/php5/apache2/php.ini
Possibly of note, I removed spaces on either side of the equals sign.
Apache restarted successfully and clicking the test link in the loader script page resulted in a success message as did subsequent script execution in my development environment dependent upon ioncube.
Actually ioncube needs its own ini files in php.d directory. Ioncube read its own file with the name of 20-ioncube.ini file.
So to do this we need to create vi /etc/php.d/20-ioncube.ini and add text: "zend_extension = /usr/lib/php/modules/ioncube_loader_lin_5.3.so" in it. Now reload php-fpm and browser. Ioncube will find zend framework now.
You can try to execute my install ioncube script in my gist, install_ioncube.sh
Or manual install follow the official wizard in other script
# run-loader-wizard.sh
curl -O https://www.ioncube.com/loader-wizard/loader-wizard.tgz
tar zxvf loader-wizard.tgz
cd ./ioncube
php -S localhost:8000
# open http://localhost:8000/loader-wizard.php

phpunit ignores /etc/php5/cli/conf.d directory on startup when launched from within eclipse [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
While I am debugging PHP Script in Eclipse, it doesn’t load mysql extension
How can I make phpunit scan the /etc/php5/cli/conf.d directory for ini files?
I am using phpunit, but it is very time-consuming to configure correctly. One issue I just encountered is that ini files for my php extensions do not seem to get loaded properly, when I Lauch phpunit as a "Run Configuration" from within Eclipse.
I basically followed this tutorial: http://pkp.sfu.ca/wiki/index.php/Configure_Eclipse_for_PHPUnit
When run from within eclipse (Menu Run.../Run Configurations...), then
the directory
/etc/php5/cli/conf.d
which is linked to
/etc/php5/conf.d/
is not parsed.
Thus, for example, file
/etc/php5/conf.d/curl.ini
is ignored.
I have to add the one-liner to the ini file
echo "extension=curl.so" >> /etc/php5/cli/php.ini
which seems to solve the problem, but it is counterproductive, because it breaks modularization (and will be gone after the next distri / php upgrade)
To find this issue, I modified phpunit.php
by adding a call to phpinfo() to the beginning of the file.
Here's the output.
PHP Version => 5.3.10-1ubuntu3.4
System => Linux wb3 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64
Build Date => Sep 12 2012 18:58:31
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /tmp/zend_debug/session6700026373526677062.tmp/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
When I inspect /tmp/zend_debug/session6700026373526677062.tmp/php.ini:
using
grep -C 2 extension
I got no output.
After adding extension=curl.so to /etc/php5/cli/php.ini
the curl extension is loaded when I run the phpunit Eclipse-Run-configuration
But the result is different when I run phpunit from the command line.
Now I get
phpunit --debug --verbose MyClass
PHP Warning: Module 'curl' already loaded in Unknown on line 0
Update: (no answers yet)
I found a workaround for my problem:
I created a custom php.ini file in the filesystem, that contains all includes appended, and within Eclipse Preferences for PHP, I create a new configuration for the php5 interpreter, using my special-purpose php.ini.
Within Eclipse Run-Configuration Menu, , setting the Config Dialog Box, I simply point to the new php5-configuration.
But this does not solve the problem, so I'm still looking for answers. Is it an eclipse problem or a phpunit - problem? I have no clue at this time.
This is an expected behavior of Eclipse PDT. For more information, see the similar question and my answer.

Cannot load mbstring module

Running a script in CLI I receive this error:
PHP Fatal error: Call to undefined function mb_detect_encoding() <script path/name here>
Some background.
PHP 5.3.10 (cli) (built: Feb 2 2012 20:27:51)
Running Windows 7 (call it a work constraint) with MySQL and Apache2.2 (both currently functional)
I understand this function is part of the module php_mbstring.dll
I will attempt an exhaustive list of efforts to get this loaded:
Verified php.ini location; phpinfo indicates the loaded file is in
c:\php; the configuration file is in c:\windows (two locations - both
have an identical .ini file)
The php.ini files have uncommented extension=php_mbstring.dll
The extension directory is specified in both php.ini files as
extension_dir = "c:\php\ext"
the specified file (php_mbstring.dll) is in fact present in the specified directory c:\php\ext\php_mbstring.dll
Although I cannot see why this would be effective, I have moved the dll to both the php root as well as windows32 directories as seen on other forums
I do have other functional non-core modules (e.g. mysqli) loaded in the same way without issue
It may be worth noting that upon uncommenting the extension line in the loaded config file (c:\php\php.ini), an additional system error of "can't start because php5.dll is missing from your computer" appears as a dialogue box. I have tried uncommenting in both and in either one and get the same error.
I suspect there is a way to load this module without recompiling or reinstalling PHP.

Eclipse and Xdebug does not parse additional ini files in /etc/php5/conf.d

I have setup Eclipse 3.6.2 on Ubuntu 11.4 for AMD64 and Xdebug.
Eclipse was installed with zip download from eclipse.org.
PHP and Xdebug were setup with apt-get.
When I run the PHP script in the shell they will use the /etc/php5/php.ini file and parse additional ini files in /etc/php5/conf.d/.
When I run in Eclipse (run mode or debug mode) it will only parse php.ini and no additional ini files.
Basically, all extensions, are not loaded.
It is an intentional bug.
PDT executes php with "-n" option always. It makes additional ini files unavailable.
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=339547
also https://bugs.eclipse.org/bugs/show_bug.cgi?id=347618
BTW, you'll be able to add a shell script which trims "-n" option as PHP Executable.(Preferences>PHP>PHP Executables)
For example,
#!/bin/sh
if [ $1 = "-n" ]; then
shift;
fi
/usr/bin/php $*
The answer #atlanto gives as a work around did and does still work, but recent version of Eclipse (I'm on Neon) has a fix that may work for you if you don't mind using the php.ini and conf.d set by default for the php executable.
The failing to load additional files only happens now if you put in an explicit php.ini file when defining a PHP executable. Leave this blank and check the box Use system default php.ini configurate.
Now if you use the location/php.ini that was specified as default when the executable was built, it will respect scanning of conf.d directories.
Here's how to check if your php has scanning conf.d enable and where the approriate default location is:
php -i "(command-line 'phpinfo()')" | grep "Configure Command"
You should see something like:
Configure Command => './configure' '--prefix=/usr/local/Cellar/php5/5.6.29_5'
'--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.6'
'--with-config-file-path=/usr/local/etc/php/5.6'
'--with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d'
'--mandir=/usr/local/Cellar/php56/5.6.29_5/share/man'
... and so on...
The items that matter are:
with-config-file-path: this where it will look for your php.ini file
with-config-file-scan-dir: this is the conf.d that will be scanned
If you still wish to choose a different in location than the default for the executable your options are:
Inline the module directives from and file in conf.d into your alternate php.ini
Rebuild php and set the above options to your new location as default
Use the wrapper script #atlanto indicates

'Memcache' not found in command line PHP script

I have Memcache installed and working for PHP apps run through Apache (v2.2) but when I try to run a .php file in the command-line i get this error:
Fatal error: Class 'Memcache' not found in /usr/local/Matters/app/matters-common/connection.php on line 94
Line 94 is:
$memcache = new Memcache;
Other info:
CentOS 5.2
PHP 5.2.5 (cli) (built: Feb 20 2008 21:13:12)
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Apache v2.2.8
Presumably you have separate php.ini files set up for apache and the command line (cli).
If so, you need to add the following to your cli php.ini file:
extension=memcache.so
On Ubuntu it's in /etc/php5/cli/php.ini
If it's working then memcache should appear in the list of modules if you run php -m on the command line.
Alternatively, you can create a file /etc/php5/cond.d/memcache.ini with the same contents.
It is possible that you have a separate php.ini file for CLI mode. This file might not include memcache extension.
I did have this kind of error and I also did php -i | grep memcache and it says memcache is enabled, but my solution that solved the problem was when I edited the php.ini, i simply modified the extension_dir="./" line to the full path of the extensions directory which now looked like this, extension_dir="/usr/local/lib" -- you need to check where the extension directory of the php reside and make sure memcache.so is there..
then i simply restarted httpd and alas the problem is gone.
you can check the detailed steps here:
http://joemarie-aliling.com/223/php-programming/php-memcache-not-found-problem/
For simplicity sake I used:
php -c /etc/php.ini ./cli-script.php
If you do not know which php.ini your command line is using, type php -i. You will get a long list of settings, where somewhere near the top of the list you will see which php.ini is being used:
Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.3.6/conf
Loaded Configuration File => /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)

Categories