I attempted to set up vi .profile for baking in cakephp but now when I open terminal (mac OSX) I get the following error
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/php_gd2.dll' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/php_gd2.dll, 9): image not found in Unknown on line 0
I can't type in any commands into terminal and pressing enter just drops the line down. The "title" of terminal says PHP 5.3.1, so I'm not sure if it somehow left the standard user mode (whatever that's called). I've restarted my computer and terminal opens up with this same message.
Is there some kind of command I can enter in the menus to revert out of this? Can someone please help me get terminal back to "normal."
edit - I went to shell->new command and typed in su root; to log in. This works, however, when I open up a new terminal window I still get the same php error and I can't figure out how to log in normally when terminal opens.
The ~/.profile by defauilt is empty on OSX (at least on my machine). So just commenting everything out or just removing the pieces you added for the cakePHP will clear the parts that are messing up your new shells.
Related
I have a use case where i need to run a node module in php script and display it's output back on the page. Here's the steps I followed:
I have installed the module npm install -g md2gslides
I am using PHP's exec() for running the module
exec('node_modules/md2gslides/bin//md2gslides.js --version 2>&1', $output);
But it's not working. The error is below:
However, it runs in ubuntu's terminal without issues.
What is wrong here?
The error not because of php but because of the path.join() in line 33 of md2gslides.js
const STORED_CREDENTIALS_PATH = path.join(USER_HOME, '.md2googleslides', 'credentials.json');
It tries to find the credentials.json in users home directory. But I think it's unable to.
So I moved the file to node_modules/md2gslides/bin and modified path.join() as path.join(__dirname, '.md2googleslides', 'credentials.json')
This solved the issue.
My python script has the following code:
firefox_profile = webdriver.FirefoxProfile()
self.driver = webdriver.Firefox(firefox_profile=firefox_profile)
When I execute the script from bash it works, but if I call the script from a PHP file, with the following command:
shell_exec("python path_to_the_script");
I receive the exception:
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmp7Ob0z6/webdriver-py-profilecopy If you specified a log_file in the FirefoxBinary constructor, check it for details.
I've also tried to set the profile manually, like this:
firefox_profile = webdriver.FirefoxProfile(profile_directory='path_to_the_profile_dir')
But nothing changed, while if I set the profile directory path like this:
firefox_profile = webdriver.FirefoxProfile(profile_directory='path_to_the_profile_dir')
firefox_profile.profile_dir = 'path_to_the_profile_dir'
The exception error changes to this:
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: path_to_the_profile_dir If you specified a log_file in the FirefoxBinary constructor, check it for details.
I've set the permissions to 777 for all the involved directories, and also tried to override the FirefoxBinary.launch_browser function so that it uses a greater timeout value, but id did not work.
I'm using Python 2.7, Selenium 2.53.6 and Firefox 46.0.1
Firefox is working in headless mode, through Xvfb and pyvirtualdisplay.
This happens because you have updated firefox to a version that's no longer supported by selenium.
So to fix this you have 2 options.
Downgrade your firefox to an older version then 47
Update Selenium and Install geckodriver (recommended and easy)
If you have ubuntu follow this fix below:
1. Update selenium with "sudo pip install -U selenium"
2. Download the geckodriver from github -->
Gecko Github Link
3. Extract the tar.gz folder and move the gecko executable to /usr/local/bin
4. Now open your terminal and enter this command: export PATH=$PATH:/usr/local/bin/geckodriver
That should fix the issue... atleast it worked for me.
My Source: StackOverflow - Geckodriver
If that didn't fix your issue check your firefox profile name
like this
fp = webdriver.FirefoxProfile('/home/YOUR_USERNAME/.mozilla/firefox/YOUR_PROFILE_NAME.default')
driver = webdriver.Firefox(firefox_profile=fp)
To find your firefox profile name open your file browser and enable "show hidden files" go to "Home/.mozilla/firefox" and you'll see your firefox profile folder.
I hope that solved your issue
So, I'm trying to run the Hello World script but whenever I run dev_appserver.py I hit a wall.
Here's the error log from the script:
$ appengine/dev_appserver.py --php_executable_path=/usr/local/bin/php-cgi HelloWorld
...
ERROR 2016-03-29 12:57:30,588 php_runtime.py:348] The PHP runtime
is not available Traceback (most recent call last): File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path) File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 284, in _check_binaries
cls._check_environment(php_executable_path, env) File "/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 259, in _check_environment
raise _PHPEnvironmentError(check_process_stdout)
_PHPEnvironmentError: No input file specified.
As a background to my El Capitan setup...
I've previously updated PHP to 5.5 using:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
But I've also downloaded via HomeBrew php54 and that's what should be running the php-cgi script I've posted in the executable path above.
Any thoughts?
So turns out, the answer was pretty obvious - I'd installed the Go SDK rather than the PHP one! Google's website scrolls to the wrong place when you click PHP. Many hours wasted trying to fix this one - never mind. Hope this helps another as simple as me!
if you already installed google-cloud-sdk run this command :
gcloud components install app-engine-php-darwin
you won't need to specify that path after this
I am trying to use xdebug to debug a really large php system. I have added the following lines to the php.ini on a Linux system:
[XDebug]
zend_extension = "/usr/lib/php4/lib/php/extensions/no-debug-non-zts-20020429/xdebug.so"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1 ;
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "/tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "/tmp"
However, after restarting apache I am unable to reload a php-generated page in the web-browser. The apache error-log contains the following output:
PHP Warning: Function registration failed - duplicate name - xdebug_get_stack_depth in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_get_function_stack in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_print_function_stack in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_get_declared_vars in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_call_class in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_call_function in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_call_file in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_call_line in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_var_dump in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_debug_zval in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_debug_zval_stdout in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_enable in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_disable in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_is_enabled in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_break in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_start_trace in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_stop_trace in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_get_tracefile_name in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_get_profiler_filename in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_dump_aggr_profiling_data in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_clear_aggr_profiling_data in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_time_index in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_start_code_coverage in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_stop_code_coverage in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_get_code_coverage in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_get_function_count in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - xdebug_dump_superglobals in Unknown on line 0
PHP Warning: xdebug: Unable to register functions, unable to load in Unknown on line 0
[Wed Jun 11 17:26:56 2014] [notice] Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/4.4.9-pl0-gentoo configured -- resuming normal operations
[Wed Jun 11 17:27:01 2014] [notice] child pid 21745 exit signal Segmentation fault (11)
[Wed Jun 11 17:27:02 2014] [notice] child pid 21752 exit signal Segmentation fault (11)
How to fix this problem so I can use xdebug to debug the php system?
Additional information:
There is also a xdebug.ini file - so I removed all xdebug related text from php.ini.
I have added the following two lines to the php code I want to debug:
xdebug_enable();
xdebug_start_trace();
Configuring Xdebug for PHP development/Linux
XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Installation
There are several ways to download and install Xdebug to your Linux box, you can do it from your software center, terminal or manual download.
Method 1: From a Linux repository
A Tip!
This is the recommended method because you will get updates and
security patches automatically.
Option 1: Terminal
Open your terminal and type
sudo apt-get install php5-xdebug
Wait until the installation process finish
Option 2: Software center
Open the software center that comes with your distribution
Type in the search box "Eclipse IDE"
Select "Eclipse IDE" in the search result list
Click on the "install" button
Wait until installation processes finish
Method 2: From a downloaded copy
Visit this page here and download the most recent version available
Do a double click on the downloaded file, your package manager should do the rest of the work automatically http://packages.debian.org/sid/php5-xdebug
Configuring Xdebug
Open your terminal and type
sudo gedit /etc/php5/mods-available/xdebug.ini
if the file is empty try this location
sudo gedit /etc/php5/conf.d/xdebug.ini
hat command should open the text editor with the Xdebug configuration file
At the end of the file content append the following text
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
Save changes and close the editor
In you terminal type
sudo service apache2 restart
Note: You can set a different port number if you need to.
Configuring Eclipse IDE
Open Eclipse IDE
On Eclipse go to: "Toolbar → Window → Preferences → PHP → Debug"
Find the option: "PHP Debugger" and set it to "Xdebug"
On Eclipse go to: "Toolbar → Window → Preferences → PHP → Debug → Installed Debugger"
In the list make sure the port the "Xdebug" option is set to the value "9000"
Save changes
Note: You can set a different port number if you need to.
When you debug a PHP project Xdebug stops the code execution of the current page and Eclipse IDE by default pops out a perspective with 2 views containing the internal Eclipse IDE web browser and the a view with the current HTML output, if you don't like the internal web browser you can use any other external web browser you got installed in your computer, such as gogle chrome, chromium, firefox, etc... don't even try IE, just kidding :p .
To set up a different web browser follow these steps if you are OK with the Eclipse internal browser skip this part:
On Eclipse go to: "Toolbar,Window,Preferences,General,Web Browser"
Make sure the option "Use external browser" is selected
If your preferred browser is on the list, select it and save changes and skip the rest of this part
If your preferred browser is not on the list press the button "New"
Set a name for your new browser i.e. "chrome"
Set the location of your new browser i.e. "/usr/bin/google-chrome"
If you don't know the location of the browser open a terminal and use the command "whereis browsername" to display the browser location. Note: Replace browsername with the name of your preferred browser i.e. "whereis google-chrome" copy one of the locations if there is more than one
Save all changes
Testing Xdebug and Eclipse IDE
To test our brand new debugging tool we need to create an Eclipse PHP project, set the debug configuration for our project and write some few lines of PHP code. This example assumes 3 things:
You understand the Eclipse IDE concepts of "workspace" and "projects", if not, pleas read this article Configuring Eclipse IDE for PHP development/Linux#Understanding the folder structure
You already have a working web server if not, pleas read this article. Configuring a LAMPP server for PHP development/Linux desktop
Your Eclipse workspace is located at the server's web root folder.
Configuring the workspace
If your current workspace is located at your server's web root skip this part
Open Eclipse IDE
On Eclipse go to: "Toolbar → File → Switch workspace → Other"
Press the button "browse" and browse the location of your server's web root folder, i.e. "/home/youruser/lamp/public_html/"
Press "OK" and wait until Eclipse IDE restarts and load the new workspace
Configuring the test project
On Eclipse go to: "Toolbar → File → New → Other → PHP → PHP Project"
Set the project name to "xdebug-test" or anything you like
Press "Ok" to continue
After this Eclipse IDE will automatically create a project folder like this "/home/youruser/lamp/public_html/xdebug-test/", also you should be able to visualize the new project at the Eclipse IDE Project Explorer view or Navigation view
On Eclipse go to: "Toolbar → File → New → Other → PHP → PHP File"
Set the file name to "index.php"
Press "Ok" to continue
After this Eclipse IDE will automatically create a PHP file like this "/home/youruser/lamp/public_html/xdebug-test/index.php", also you should be able to visualize the new file at the Eclipse IDE Project Explorer view or Navigation view
Find the new "index.php" file at the Eclipse IDE project explorer and open it doing double click on it
Place the following content to that file:
<?php
$X = 5;
$X = 8;
$Y = 2;
$Z = $X + $Y;
$Z = $Z + 1;
echo "Z value is: " . $Z;
?>
Save changes
open your web browser and navigate to
"http://example.com/xdebug-test/index.php"
It should display a web and output like this
Z value is: 11
Configuring the test project debug information
On Eclipse go to: "Toolbar → Run → Debug configuration..."
On the left list find "PHP Web Application" and do a double click on it to create a new configuration element
Select the new configuration element to display it content
Set the name to "xdebug-test" or anything you like
Make sure the option "Server debugger" is set to "Xdebug"
Make sure the option "Break at first Line" is not checked
In the option "File" press the button "Browse", find your project "xdebug-test" and expand it content, then find and select the file "index.php"
Make sure that option URL looks something like this "http://example.com/xdebug-test/index.php"
Press "Apply" and "Close" to save changes and continue
Debugging the test project
As you can see our "index.php" file have several lines of code, with the debugger we can study how those lines of code that are being executed one by one, but to stop the execution we need to set something called "Breakpoint", a Breakpoint is a "mark" in our lines of code that indicate to the debugger to stop the execution and poll the var values. To set a Breakpoint on our code and test the debugger follow this simple steps.
Open the "index.php" of our test project
Locate the line of code "$X
= 8;" and do a click on it to place the blinking cursor there
On Eclipse go to: "Toolbar → Run → Toggle Breakpoint", you can also used
the hotkey "shift+ctrl+B" or simply do a double click on the line
number of the line of code at the very left side of your editor to
toggle a Breakpoint
When a Breakpoint is set you should see it
represented as a little circle next to the line number at the very
left side of your editor
Now is time to execute our project to see how the debugger help us to debug the code.
On Eclipse go to: "Toolbar → Run → Debug", you can also used the hotkey "F11" or simply do a click in the "little bug icon" located at the second toolbar from the top
Automatically Eclipse will open the configured web browser, and also change to the "Debug perspective", the debug perspective contains a set of pre-configured views useful to do debugging tasks, among them we got:
Debug view: It display buttons to control the current running debug session and also this view contains the current call stack
Breakpoint view: display all the your set breakpoints on any project file
Variables view: Is is basically a "var dump" of all the PHP variables of your actual session, it view let you easily navigate throw any variable and child members of those variables.
Expressions view: there you can set custom expressions i.e. "$X+$Y+$Z" and see the outcome of each expression without changing the code at all.
Internal browser view and output view: optional if you not configured an external browser Eclipse IDE will display this view with the current page and the current page HTML output
At this point our web page should look stopped and most likely the browser will show a blank page "waiting" to load the rest of it
Note that the current breakpoint have a "little arrow" over the circle and the line of code if highlighted, this indicated what is the next line of code to be executed, also know as the "current step"
If you take a look at the "variables view" the current value of "$X" should be "5"
Go to the "Debug view" and press the button "step over" or use the hotkey "F6" to go one step forward in the code execution
Take another look at the "variables view" the current value of "$X" should be now "8"
This way you can neatly study how your code and values changes step by step, you can also hover your mouse pointer over the variables names in the editor Eclipse IDE will pop up the current value of them.
Keep going froward until the end of the lines of code, at that point the web browser should display the final web page output
Hi I just installed PHPStorm 5 for the first time to give it a try and I seem to be having a problem in running PHP applications.I have installed xampp and the path to the PHP interpretator has been set to:
D:\Program Files\xampp\php\php.exe
When I try to run I php file I get this error:
"D:\Program Files\xampp\php\php.exe" D:\Program Files\xampp\php\php.exe "D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
Could not open input file: D:\Program
Process finished with exit code 1
For some reason it seems that PHPStorm does not read the rest of the path and it stops at D:\Program.
How can I correct this problem besides changing the name of the folder because that would require me to reinstall almost everything on my computer again?
EDIT RUN CONFIGURATION
Look the full command-line:
"D:\Program Files\xampp\php\php.exe" D:\Program Files\xampp\php\php.exe ⤦
"D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
You are using the command:
"D:\Program Files\xampp\php\php.exe"
With the following three parameters:
D:\Program
Files\xampp\php\php.exe
"D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
You php.exe then tries to open the "file"
D:\Program
and naturally fails. Instead your command should be:
"D:\Program Files\xampp\php\php.exe" c:\path\to\your\script.php
Obviously you did enter the text D:\Program Files\xampp\php\php.exe into too many textboxes as it belongs to. If you're new to PHPStorm I suggest you read the online manual:
Interpreters - PhpStorm 5.0 Web Help
Run/Debug Configuration: PHP Script - PhpStorm 5.0 Web Help
It's also available by pressing F1 when you're in a dialog.
Edit: Clear the field named Interpreator Options