Zend_Tool problem - zend-studio

This is the third time I'm installing zend studio and zend server now these two are installed succesfully (after half a day). But when I'm trying to create a new project I always get this zf error...
`
*************** ZF ERROR ****************
In order to run the zf command, you need to ensure that Zend Framework
is inside your include_path. There are a variety of ways that you can
ensure that this zf command line tool knows where the Zend Framework
library is on your system, but not all of them can be described here.
The easiest way to get the zf command running is to give it the include
path via an environment variable ZEND_TOOL_INCLUDE_PATH or
ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
then run the command "zf --setup". This command is designed to create
a storage location for your user, as well as create the zf.ini file
that the zf command will consult in order to run properly on your
system.
Example you would run:
$ ZEND_TOOL_INCLUDE_PATH=/path/to/library zf --setup
Your are encourged to read more in the link that follows.
Zend_Tool & CLI Setup Information
(available via the command line "zf --info")
* Home directory found in environment variable HOMEPATH with value \Users\admin
* Storage directory assumed in home directory at location \Users\admin/.zf/
* Storage directory does not exist at \Users\admin/.zf/
* Config file assumed in home directory at location \Users\admin/.zf.ini
* Config file does not exist at \Users\admin/.zf.ini
To change the setup of this tool, run: "zf --setup"
ok (took 0:04.038)
`
I've already set the ZF_INCLUDE_PATH via command line with a new zend-framework library.
I never had a clean install with anything related to zend.
Could someone help me with this?
Thanks

I presume from the paths you are working on a windows machine. Zend Studio uses the zend tool (zf.bat in windows) to create a project. To make it work you must have properly installed the zend tool, i.e. you must be able to open a console (WINDOWS+R, type cmd, type enter) and successfully run the zf command.
In your case probably is a path issue, that you can resolve following the instructions here: http://framework.zend.com/manual/en/zend.tool.framework.clitool.html#zend.tool.framework.clitool.setup-windows
In particular:
The most common setup in the Windows Win32 environment, is to copy the zf.bat and zf.php into the same directory as your PHP binary. This can generally be found in one of the following places:
C:\PHP
C:\Program Files\ZendServer\bin\
C:\WAMP\PHP\bin
You should be able to run php.exe on the command line. If you are not able to, first check the documentation that came with your PHP distribution, or ensure that the path to php.exe is in your Windows PATH environment variable.
The next order of business is to ensure that Zend Framework library is set up correctly inside of the system PHP include_path. To find out where your include_path is located, you can type php -i and look for the include_path variable, or more succinctly execute php -i | grep include_path if you have Cygwin setup with grep available. Once you have found where your include_path is located (this will generally be something like C:\PHP\pear, C:\PHP\share, C:\Program%20Files\ZendServer\share or similar), ensure that the contents of the library/ directory are put inside your include_path specified directory.

If you are running on Ubuntu or Debian--or maybe Linux in general--it now seems you must create the environment variable ZEND_TOOL_INCLUDE_PATH. Having zend framework in your include_path (or copying zend framework to you existing include_path) no longer seems to work.
To manually install the latest version zend framework on Ubuntu/Debian, this is what I did after downloading ZF and extracting it to ~/temp
sudo cp -R ~/temp/ZendFramework-1.11.11/library/Zend /usr/share/php
sudo cp -R ~/temp/ZendFramework-1.11.11/extras/library/ZendX /usr/share/php
sudo cp ~/temp/ZendFramework-1.11.11/bin/zf.sh /usr/bin
sudo cp ~/temp/ZendFramework-1.11.11/bin/zf.php /usr/bin
Next edit /etc/environment, if you want other programs, like Netbeans, to be able to invoke zf.sh. Edit ~/.pam_environment, if you want only the current user to execute zf.sh. Add this line:
ZEND_TOOL_INCLUDE_PATH=/usr/share/php
You may need to log out and log back in after doing this.

Related

Installing YAML for PHP in IIS

I am trying to install the YAML 1.2 extension to PHP 5.6 under IIS 10 (Windows 10). I am using http://pecl.php.net/package/yaml/1.2.0/windows to download the files.
I have downloaded the PHP 5.6 non-thread-safe DLL (x86 to match my version of PHP), copied php_yaml.dll to my extension directory, copied yaml.dll to C:\Windows\System32 (which is reported as one of the paths in phpinfo()) and added extension=php_yaml.dll to my php.ini. I've verified with phpinfo() that the correct php.ini file is being loaded, and commenting out other extensions removes them from the output of phpinfo().
However, YAML doesn't appear in the output of phpinfo() and the functions are not loaded. Running php-cgi.exe -v from the command line gives a warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\php_5_06_14\ext\php_yaml.dll' - The specified module could not be found.
in Unknown on line 0
The file exists at the location specified and the permissions appear to be correct. What else can I do to get it working?
As far as I can tell, the use of PECL as package manager is being in dropping.
Having to install extensions in a server makes things more complicated and it depends on the environment, permissions, etc.
I'm sure someone could help you solve that (I haven't work on windows in years, so I can't)
But, instead I suggest you another solution. Maybe you can opt for it, maybe you have to stick with the extension, but, in case you can actually look for other option, I suggest you to use another library.
https://github.com/symfony/yaml
And, you could use Composer to install your libraries, I suggest you take a look at it.
Again, it may be for you or not, but I think this would be a lot easier.
I hope that helps.
I put the path to my extension directory in the path environment variable. That fixed the issue for me.

Making Sphinx documentation inside of a virtual environment with cron

I have an application development server that is automatically updated every night with a massive shell script that we run with crontab. The script specifies #!/bin/sh at the top of the file and I am not able to change that. The basic purpose of the script is to go through the machine and download the latest code in each of the directories that we list in the script. After all of the repositories are updated, we execute a number of scripts to update the relevant databases using the appropriate virtual environment (Django manage.py commands) by calling that virtualenv's python directly.
The issue that I am having is that we have all the necessary Sphinx plugins installed in one of the virtual environments to allow us to build the documentation from the code at the end of the script, but I cannot seem to figure out how to allow the make command to run inside of the virtualenv so that it has access to the proper packages and libraries. I need a way to run the make command inside of the virtual environment and if necessary deactivate that environment afterwards so that the remainder of the script can run.
My current script looks like the below and gives errors on the latter 3 lines, because sh does not have workon or deactivate, and because make can't find the sphinx-build.
cd ${_proj_root}/dev/docs
workon dev
make clean && make html
deactivate
I was able to find the answer to this question here. The error message that is shown when you attempt to build the sphinx documentation from the root is as follows, and leads to the answer that was provided there:
Makefile:12: *** The 'sphinx-build' command was not found. Make sure
you have Sphinx installed, then set the SPHINXBUILD environment
variable to point to the full path of the 'sphinx-build' executable.
Alternatively you can add the directory with the executable to your
PATH. If you don't have Sphinx installed, grab it from
http://sphinx-doc.org/. Stop.
The full command for anyone looking to build sphinx documentation through a cron when all tools are installed in various virtual environments are listed below. You can find the location of your python and sphinx-build commands by using which while the environment is activated.
make html SPHINXBUILD='<virtualenv-path-to>/python <virtualenv-path-to>/sphinx-build'

npm global install does not add packages to PATH on Windows 8.1

When I run npm install -g <package> it installs the packages in my user/AppData/Roaming/npm/npm_modules/ folder. This sub-folder is not in my PATH so if I try to run the package without explicitly calling the entire path the call fails with a '<package>' is not recognized as an internal or external command, operable program or batch file.
What can I do to fix this?
Thanks
I'm using win8.1 and I found that the nodejs installer didn't add the path to global node modules to the system PATH. Just add %AppData%\npm; to the user variable(since %AppData% dir is depending on user) PATH to fix it.
You will need to log out then log back in for the change to your PATH variable to take effect.
SET PATH=%AppData%\npm;%PATH%
You have to run this line SET PATH=pathtonodejs;%PATH% (where pathtonodejs is where you installed nodejs) once the installation for nodejs is complete and it should work.
It turned the problem was a change in behavior of the module I was using.
I'd been following old tutorials for using Express.js. The old tutorials assumed Express would be in my path after installing it globally, but as of Express v4.0 there's a separate Express module you have to install in order to get it in your path

How to get Sphinx working with Jython on an unnetworked Windows 7 computer?

Once sphinx-apidoc has been run the command C:\path\to\doc\make html produces an error beginning:
The 'sphinx-build' command was not found [snip]
However the command does exist and the relevant environment variables are set.
More detail:
1 - Trying to run sphinx_apidoc:
'C:\path\to\jython\bin\sphinx-apidoc' is not recognised as an internal or external command
2 - Called using Jython works: jython C:\path\to\jython\bin\sphinx-apidoc with sensible options produces the documentation *.rst files, conf.py, etc files.
3 - make html then produces the following error:
The 'sphinx-build' command was not found [snip]
It then recommends setting the SPHINXBUILD environment variable, and even the PATH. I already have these two environment variables set, proven to myself by calling echo %PATH% and echo %SPHINXBUILD%.
This is where I get stuck. It appears that the files that Sphinx uses (sphinx-apidoc and sphinx-build in this case), which are in the C:\path\to\jython\bin\ directory, do not have any file suffixes. When called directly from Jython they work as expected (see point 2 above), however when called as part of another process (e.g. make html) they are not recognised and the execution fails (see points 1 and 3 above).
Does anyone know the what, why and most importantly 'how to fix' of this problem?
My setup process is on an unnetworked Windows 7 computer. Jython (2.5.2) was installed using the Jython installer. Then each of the following packages (except setuptools) was installed by extracting it locally and then running jython setup.py install in its extracted directory:
setuptools: by calling jython ez_setup.py with setuptools-1.4.2.tar.gz in the same directory (so there is no attempt to download it)
Jinja2 (2.5)
docutils (0.11)
Pygments (1.6)
Sphinx (1.2.1)
numpydoc (0.4) - Only mentioned because it is also isntalled on the machine.
I have managed to get it working. The problem was that the manual installation and the use of Jython meant that certain environment variables that were expected were not in place. Also, the use of Windows 7 (and I believe MS Windows in general) means that Python scripts without an extension cannot be run without calling them explicitly through Jython (Windows doesn't check for shebangs). Finally, file associations had not been set up (as happens automatically with CPython installation, but has not happened with Jython).
For anyone else with similar problems the following setup works for me:
Locations:
Java Runtime: C:\Java\jre7
Jython: C:\Jython\jython2.5.2
User Environment Variables:
JRE_HOME: C:\Java\jre7
JAVA_HOME: %JRE_HOME%
CLASSPATH: .
JYTHON_HOME: C:\Jython\jython2.5.2
PATH: %JRE_HOME%\bin;%JYTHON_HOME%\bin
File Associations:
At the command prompt type assoc .py=Python.File to associate 'Python.File' with the '.py' extension.
At the command prompt type ftype Python.File=C:\Jython\jython2.5.2\jython.bat "%1" %* to associate the Jython command with files of type 'Python.File'.
Append '.py' (;.PY) to the PATHEXT system environment variable. This will make it possible to execute Python files without having to provide their '.py' extension. (N.B. This does not make it possible to run Python files that do not have a '.py' extension.)
File Extensions:
Rename the four Sphinx commands to include '.py' extensions. This is remarkably difficult with vanilla Windows 7 as it does everything it can to distance the user from such 'low level' details as file extensions, however the rename command at the command prompt does the job: type ren sphinx* sphinx*.py when in the Jython bin directory.
It should now be possible to call sphinx-apidoc or similar from anywhere. Once this is complete the command make html, when called from the documentation directory, should work as expected.

Where should I install Composer?

Just wondering where I should install Composer. It kind of wrecked my environment last time. I'm running XAMPP and i'm looking to use it within some Framework sites. So to me the XAMPP folder itself seems appropriate. Would that be correct? The main thing for me is that it doesn't alter any environment paths or the such.
Any advice would be great.
The main aspect is that you'd probably want to run Composer easily in the command shell. This implies that Composer has to be in any directory mentioned in the path variable.
Have a look at your current path, pick a convenient directory, and put the composer.phar file there.
If you don't like that, you could also create a batch file that does run PHP with that phar file in a different location, and passes all the other command line arguments to it.

Resources