linux php执行shell,报错 命令找不到

1、PHP调用shell函数

string system ( string $command [, int &$return_var ] )

string exec ( string $command [, array &$output [, int &$return_var ]] )

void passthru ( string $command [, int &$return_var ] )

2、shell文件的话,注意问题

1)第一行:#!/bin/bash
2)注意换行格式
3)给shell有执行权限。sudo也行

3、报错找不到命令

找不到命令,需要用命令的绝对路径:
例:source /home/dell/anaconda3/bin/activate /home/dell/anaconda3/envs/py38

 

posted @ 2023-05-12 10:15  张志健  阅读(66)  评论(0编辑  收藏  举报