"Task: you need phpmyadmin, create a link to / usr / share / phpMyAdmin in the root of the site with any name and enter"

у меня не получается , проверила существование ссылки - обе ссылки существуют. //echo "is=".file_exists($_SERVER["SCRIPT_FILENAME"]');//возвращает 1 //echo "is=".file_exists('/usr/share/phpMyAdmin'); //возвращает 1 //die(); //exec('ln -s /usr/share/phpMyAdmin '.$_SERVER["SCRIPT_FILENAME"]); // не работает , пустая страница вылезает exec('ln -s /usr/share/phpMyAdmin '.$_SERVER["SCRIPT_FILENAME"], $output); var_dump($output); //возвращает пустой массив array(0) { } 

how to fix.

    2 answers 2

    Use symlink () , not exec() :

    Return values

    Returns TRUE on success, or FALSE on error.

    Also for the future: it is recommended not only to check the existence of a file on a disk through file_exists() good tone - but also with the help of is_dir to check whether the file is not a directory (from the point of view of the OS linux, the directory is also a file) or a symlink when is_link help. It seems to me that these functions are unknown to you.

    If a symlink is not created, it would be good to check if the user, under which the web server works, has access to create a symlink.

    • echo is_link('/usr/share/phpMyAdmin/'); echo is_link($_SERVER["SCRIPT_FILENAME"]); nothing out. Did `echo symlink ('/ usr / share / phpMyAdmin', $ _SERVER [" SCRIPT_FILENAME "]);` did not help - NNN
    • shell_exec("cd /usr/share/phpMyAdmin/"); or shell_exec("cd /home/bitrix/www/phpmyadmin/"); $output = shell_exec('ls -al'); echo "<pre>$output</pre>" $output = shell_exec('ls -al'); echo "<pre>$output</pre>" ; did not help. something output the same file structure, not similar to the structure of files phpmyadmin - NNN

    the ln command, if everything went well, returns nothing but the system STDERR = 0. No text.

    To get the system error code you need to run

     exec('command', $output, $error); 

    where output will go to $ output to the stdout stream, and $ error will receive the integer return code of the command

    In order to get both stdout and stderr in $ output, you need to supplement the command being run in this way

     exec('command 2>&1', $output, $error); 
    • exec ('ln -s / usr / share / phpMyAdmin'. $ _ SERVER ["SCRIPT_FILENAME"], $ output); var_dump ($ output); // returns an empty array array (0) {} - Is this STDERR = 0? - NNN
    • Give the exact output of the var_dump in question - rjhdby
    • Here is the output of array (0) {} - NNN
    • @NNN in $ output returns exactly the console output of the command being executed. STDERR is a return code, neither does it fit into the standard or erroneous output. Updated the answer to understand. - rjhdby