I am running the following script on a cronjob...
cd /etc/parselog/
php run_all.php >/dev/null
and am getting the following errors:
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './mysqli.so' - ./mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './odbc.so' - ./odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo_mysql.so' - ./pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo_odbc.so' - ./pdo_odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo_sqlite.so' - ./pdo_sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Fatal error: Call to undefined function mysql_connect() in /etc/parselog/stats_downloads.php on line 5
However, when I run the same script from the command line, logged in- it works perfectly without error.
This is my $PATH string at the prompt:
$PATH = /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
Any ideas or suggestions? I am certain when running the cronjob, it does not have a lib path or something included. I even tried adding the exact path
Tip 1: Ensure you have exactly the same $PATH in the cron job:
cd /etc/parselog/
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
php run_all.php >/dev/null
Tip 2: Make sure all other environment variables match as well. Dump the environment with the command env, and add the corresponding exports to your cron job.
Generally when something fails during cron but runs on the command line it's permissions, working directory, or environment variables.
It looks like the php executable itself isn't loading the libraries, the problem might not be in your script.
When you run a script in a cron job, it is run in a limited shell with very few environment variables set. From your errors, it looks like it may be the LD_LIBRARY_PATH that needs to be set as the errors pertain to a bunch of shared libraries, but that is just a guess. It looks like the proper library paths for PHP are not being set up correctly in the cron script.
You can capture the environment used when running the cron script by adding the env command to the script and capturing the output. Compare this to the env output at the prompt and look for variations. Most likely they will be from commands issued in either your local or system profile or bashrc (or maybe even .login) files that set up library paths. I'd specifically look for paths and variables related to PHP since that seems to be your issue.
I had to deal with this issue several times on my last project and the basic solution is to:
determine the minimum environment needed to execute the script
create a short script that sets up the desired environment
add a call to the script from item 2 in the script launching your applications so that the environment is set up properly.
Test thoroughly to make sure you didn't miss anything :-).
When a cron job is run from the users crontab it is executed as that user. It does not however source any files in the users home directory like their .profile, .cshrc, or .bashrc or any other file. If you need cron to source (read) any file that your script will need you should do it from the script cron is calling. Setting paths, sourcing files, setting environment variables, etc.
Related
I cannot for the life of me figure out what triggered this, and no other post seems to cover it. Can of youshed some light and help me resolve this matter? I am suing homebrew for my php. How can I go back to business as usual via php71 or greater? I am using a mac.
THE FOLLOWING IS THE ERROR:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): image not found in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
Warning: Module 'mcrypt' already loaded in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/7.1
Loaded Configuration File: /usr/local/etc/php/7.1/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.1/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.1/conf.d/ext-intl.ini,
/usr/local/etc/php/7.1/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/7.1/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.1/conf.d/ext-xdebug.ini,
/usr/local/etc/php/7.1/conf.d/php-memory-limits.ini
So the short answer to this is, I ripped out Pear and pcel and anything else related to it I had just added, along with php71/Nginx and reinstalled php72/nginx (more os to be up to date as well), but once I symlinked it all restored to working form.
The real culprit here was pear, as I was originally trying to install xdebug, but pear/pcel took over my php setup and shit hit the fan!
We are no in a much better place, backtrace your steps like I did folks!
I try to load PHP from console (in windows) and when I run phpinfo.php the line
Loaded Configuration File => (none)
but when I run this pagin in web browser I see it:
Loaded Configuration File C:\MAMP\conf\php5.6.28\php.ini
My problem appear when I try to install symfony
Warning: readfile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
Warning: readfile(https://symfony.com/installer): failed to open stream: Invalid argument in Command line code on line 1
I can't able to download this file from console, can anyone help me please?
I am currently hosting on 1und1.de. my codes work on localhost but upon uploading it on the shared hosting server i got the following errors:
Warning: Unknown: open(C:\xampp\tmp/sess_bnt91ftgq6s4obn2684fud47p5, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\xampp\tmp) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_bz2.dll' - C:\xampp\php\ext/php_bz2.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_curl.dll' - C:\xampp\php\ext/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_mbstring.dll' - C:\xampp\php\ext/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_exif.dll' - C:\xampp\php\ext/php_exif.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_gd2.dll' - C:\xampp\php\ext/php_gd2.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_gettext.dll' - C:\xampp\php\ext/php_gettext.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_mysql.dll' - C:\xampp\php\ext/php_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_mysqli.dll' - C:\xampp\php\ext/php_mysqli.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_openssl.dll' - C:\xampp\php\ext/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_pdo_mysql.dll' - C:\xampp\php\ext/php_pdo_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_pdo_sqlite.dll' - C:\xampp\php\ext/php_pdo_sqlite.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_soap.dll' - C:\xampp\php\ext/php_soap.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_sockets.dll' - C:\xampp\php\ext/php_sockets.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_sqlite3.dll' - C:\xampp\php\ext/php_sqlite3.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_xmlrpc.dll' - C:\xampp\php\ext/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_xsl.dll' - C:\xampp\php\ext/php_xsl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: Cannot open 'C:\xampp\php\extras\browscap.ini' for reading in Unknown on line 0
What does these errors mean. does these errors have something to do with my hosting provider?
I had this error locally with this message:
Warning: Cannot open "\xampp\php\extras\browscap.ini" for reading in
Unknown on line 0
By changing this line of php.ini file :
browscap="\xampp\php\extras\browscap.ini"
to this:
browscap="C:\xampp\php\extras\browscap.ini"
the error has gone.
It looks as though you've probably copied your php.ini configuration file directly from your system to your hosting server. Don't do that. The data in your configuration file is specific to your XAMPP installation; this is not appropriate for the web server, and is causing these errors because the files referenced in your configuration do not exist on the server.
Sometimes people here are not as they could be...
For whatever reason, your php.ini is mis-configured.
One thing to note that all those missing files are actually Windows files (*.dll) on Linux these would likely be *.so files. I'm assuming your hosting on a Linux server.
First find your php.ini file. If you have command line access via SSH, you can try running:
php --ini
if not you make a simple script, call it test.php like so:
<?php
phpinfo();
?>
Upload the file and run it, something like:
http://www.yoursite.com/test.php
Among the information provided will be the path to php.ini
Once you find it, one option is to edit it and comment out all those extensions, by putting a ";" in front of the line.
Another option is to check if the *.so files exist. Look for them under /usr/lib/php. If they exist, edit your php.ini file to have all those extension end in .so instead of .dll
Finally, if they don't exist, you could install them by using apt-get or yum. An example:
sudo apt-get install php-mbstring
I have a problem about php on centos. When I want to run php script I have problem like that below,
# php removespikes.php -R=/var/www/html/cacti-0.8.8a/rra/gyt_traffic_in.rrd
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/phpchartdir530.dll' -
/usr/lib64/php/modules/phpchartdir530.dll: cannot open shared object
file: No such file or directory in Unknown on line 0
How can I fix this problem?
When I try to run my script I at first I put the shebang in the script at the top and then tried this:
php -f /home/phil/www/disable_script.php
But I'm immediately greeted by this:
PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/zlib.so' - /usr/lib/php4/zlib.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Call to undefined function: date_default_timezone_set() in /home/phil/www/disable_script.php on line 3
When I just say:
php -v
I get:
PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/zlib.so' - /usr/lib/php4/zlib.so: cannot open shared object file: No such file or directory in Unknown on line 0
What should my next step be? Do I need to reinstall php?
Sounds like there's a setting in your php.ini that is trying to load an extension that it can't find. Check to make sure the extension exists or edit your php.ini so it doesn't try to load the extension.
Also, date_default_timezone_set() is only available in PHP 5.1.0 or later. Your install looks to be PHP4.
PHP4 is old, ugly and not supported anymore. You should upgrade to PHP5 as soon as possible.
before that extension list (the .so's resp. dll's on Windows) the php.ini says:
; extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
I had luck with giving an explict path, i.e.
extension=d:\dev\fronker\php\ext\php_openssl.dll