LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-29-2006, 08:31 PM   #1
alain
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Rep: Reputation: 0
cannot get tu run a php script in cron


hello, can anyone help

I am using cron via Plesk

I am trying to find what the path to the php installation do do so I type the following command:
WHICH PHP

this is the email I get
which: no PHP in (/usr/bin:/bin)

As I am new to unix I need some help
 
Old 01-29-2006, 11:12 PM   #2
patrokov
Member
 
Registered: Jan 2006
Location: Riviera Beach
Distribution: Slackware -current, ArchLinux
Posts: 59

Rep: Reputation: 15
It means that you probably don't have PHP installed on your computer and you need to install it.

[Edit]
Sorry, missed the part about the which results being e-mailed to you. I assumed you had typed it. Moral, don't answer questions just before going to bed.

Last edited by patrokov; 01-31-2006 at 11:48 PM.
 
Old 01-30-2006, 11:09 PM   #3
alain
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Original Poster
Rep: Reputation: 0
thank you for your help - but I do have php install on my server. I am running several php scripts---
 
Old 01-31-2006, 12:13 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
cron doesn't have the same environment as you; to get this working you'll
have to find where php lives ('which php') and add the path to it to your
cron-tab entry
e.g.
0 2 * * * PATH=$PATH:/path/to/php your_script

HIH



Cheers,
Tink
 
Old 01-31-2006, 02:18 AM   #5
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
In Vixie cron, there's an easier way.
Just add
PATH=$PATH:/path/to/php
once at the top (before the configuration of your jobs)

This way, you can have multiple PhP cron jobs that all have PhP in $PATH without
having to type the PATH= in front of each job.
 
Old 02-02-2006, 08:24 PM   #6
alain
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Original Poster
Rep: Reputation: 0
crontab

thank you for your help did run which php to get path

It seems that my hosting company has a php module that is trying to load but does not exist. Is that right. Anyone know how to fix that.

THank you

but I got the following error PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php4/pgsql.so' - libpq.so.3: cannot open shared object file: No such file or directory in Unknown on line 0
No input file specified.

Quote:
Originally Posted by Tinkster
cron doesn't have the same environment as you; to get this working you'll
have to find where php lives ('which php') and add the path to it to your
cron-tab entry
e.g.
0 2 * * * PATH=$PATH:/path/to/php your_script

HIH



Cheers,
Tink
 
Old 02-06-2006, 02:54 AM   #7
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
The error message you have posted sais simply that the web server can't find
the pgsql.so shared library, which refers to the libpq.so.3 library.
As the names of these libraries suggest, the libraries handle the access to PostGres SQL databases.

So, if your site (PhP code) is trying to access/use such a database, it will fail to do so, simply because the
required library cannot be found.

Note that this can also be an environment issue. Most shared libraries are found via specific environment variables, like LD_LIBRARY_PATH and alike.

The fix is rather simply, if you have access to the web server. If you don't have that, ask your ISP (or whomever has sufficient access) to set up the PostGres support in PhP for you.
If you have access, you may want to try:
-looking for the libraries that are said to be "missing". If they are on the system, but the website can't find them, then it's most like an environment issue. Use tools like "locate", "slocate", "which" and/or "whereis" to find the libs and also look at your environment variables.
-if the libraries are not on your system, then you need to install them. You may want to download them from
a PhP related website, or you may also be able to find them on some general package downloading sites, like
rpmfind.net and alike.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
FTP Script will not run from Cron grhansen Programming 12 01-13-2006 04:13 AM
php script will not run correctly as cron, fine from cli dtra Linux - Software 2 12-22-2005 07:21 AM
run shell script on cron varunbihani Linux - Newbie 5 07-08-2005 01:50 AM
can't get cron to run my script. dr_zayus69 Linux - Software 6 04-12-2005 06:34 PM


All times are GMT -5. The time now is 01:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration