EX-5.1 3 a2086854zex-5_1.htm EXHIBIT 5.1
QuickLinks -- Click here to rapidly navigate through this document


EXHIBIT 5.1

OPINION OF COOLEY GODWARD LLP

August 14, 2002

Pharsight Corporation
800 West El Camino Real—Suite 200
Mountain View, CA 94040

Ladies and Gentlemen:

You have requested our opinion with respect to certain matters in connection with the filing by Pharsight Corporation (the "Company") of a Registration Statement on Form S-3 (the "Registration Statement") with the Securities and Exchange Commission covering the offering of up to (i) 7,908,352 shares of the Company's Common Stock (the "Common Shares") issued pursuant to various private placement transactions, (ii) 7,258,648 shares of the Company's Common Stock (the "Converted Shares") issuable upon conversion of 1,814,662 shares of Series A Convertible Preferred Stock ("Series A Preferred") sold pursuant to the Preferred Stock and Warrant Purchase Agreement, dated as of June 25, 2002, by and among the Company and the purchasers named therein (the "Agreement"), (iii) 1,910,726 shares of the Company's Common Stock (the "Warrant Shares") issuable upon exercise of the warrants sold pursuant to the Agreement and other warrants issued by the Company (collectively, the "Warrants"), and (iv) 1,161,378 shares of the Company's Common Stock (the "Dividend Shares") issuable upon conversion of approximately 290,344 shares of Series B Convertible Preferred Stock which may be issued as dividends on the Series A Preferred.

In connection with this opinion, we have examined the Registration Statement and related Prospectus, your Certificate of Incorporation, Certificate of Designations of Series A and Series B Convertible Preferred Stock (the "Certificate of Designations") and By-laws, as amended, and such other documents, records, certificates, memoranda and other instruments as we deem necessary as a basis for this opinion. We have assumed the genuineness and authenticity of all documents submitted to us as originals, the conformity to originals of all documents submitted to us as copies thereof, and the due execution and delivery of all documents where due execution and delivery are a prerequisite to the effectiveness thereof.

On the basis of the foregoing, and in reliance thereon, we are of the opinion that: (i) the Common Shares are validly issued, fully paid and nonassessable, (ii) the Converted Shares and the Dividend Shares will be, when issued upon conversion and sold in accordance with the Agreement and the Certificate of Designations, validly issued, fully paid and nonassessable, and (iii) the Warrant Shares will be, when issued and sold in accordance with the Agreement and the Warrants, as applicable, validly issued, fully paid and nonassessable.

We consent to the reference to our firm under the caption "Legal Matters" in the prospectus included in the Registration Statement and to the filing of this opinion as an exhibit to the Registration Statement.

Very truly yours,

COOLEY GODWARD LLP    

By: /s/  
BRETT D. WHITE      
Brett D. White

 

 



QuickLinks