Getting started with Zend Framework 1 - php

I've just heard about ZF and it's been kicking my butt all day (it's almost 11pm right now)...
I've added an include for ZF in my php.ini file and I've created environment variables for ZF and PHP:
User Variable (name : value)
ZEND_TOOL_INCLUDE_PATH : C:\xampp\ZendFramework-1.12.3\bin
System Variable (name : value)
Path : C:\xampp\php\
When I try to run zf create project quickstart from my command line, I get an error telling me about using the User Variable I've already set:
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".
I'm really at a loss as to what I'm supposed to do here or whether or not I've done something wrong...
Can anyone give any advice?

Related

realpath() doesnt show realpath GitLab ci runner

the code is stored in /var/www/abc -- "CodePath"
when running gitlab-ci (runner), the code is called via /home/gitlab-runner/builds/4v8bC1n9/0/_gitlabgroup_/_gitprojectname_/abc -- "RealPath"
I'm using a local runner and a shell execution.
when I use the realpath() function in my php code, it still shows the "CodePath" when using gitlab ci runner, instead of "RealPath".
How can I get the "RealPath" integrated in my code, or reconfig GitLab to use the "CodePath" instead?
The runner cli options are documented here: https://docs.gitlab.com/runner/executors/shell.html#overview
The path where the job is run and your sources are cloned into is available in the environment variable:
CI_PROJECT_DIR
The full path where the repository is cloned and where the job is run. If the GitLab Runner builds_dir parameter is set, this variable is set relative to the value of builds_dir. For more information, see Advanced configuration for GitLab Runner.
You did no state how you use realpath(path)...
Whilst a path must be supplied, the value can be an empty string. In this case, the value is interpreted as the current directory.
So maybe you hardcode chdir('/var/www/abc'); somewhere?
When you do chdir(getenv('CI_PROJECT_DIR')); before you call realpath() - it should use the CI directory. Assuming you use realpath without a parameter.
Also: maybe you can make some changes and use one of the the built in constants for the current directory: https://www.php.net/manual/en/language.constants.predefined.php
Thanks to madflow's mentioning of the variable I managed to figure out the following:
runners specific configuration files exist and can be configured as described here
I needed to do these things:
specify enable the [runners.custom_build_dir] section in the config.toml
[[runners]]
builds_dir = "/var/www/abc"
[runners.custom_build_dir]
enabled = true
(boolean not in quotes)
specify a variable in my yml
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/
on os level there was some privilege setting for the dir required, where I went for quick and dirty 777 on my local machine

Zend framework in Xampp

I recently downloaded the full package version(recommended) of ZendFramework(2.0.5).And tried and failed to install in xampp(version 1.7.4) also my php version is 5.3.5 .
I have done almost everything that is said to do like-
1.find php.ini and add path
include_path = ".;C:\xampp\php\Zend\library\zend\;C:\xampp\php\PEAR;"
2.Extract the downloaded Zend Framework folder and copy to your PHP include path.
I have also checked the folder(xampp,php,Zend) permissions too.I have checked and rechecked my tries multiple times but that error is not solved.
Exception thrown trying to access Zend/Loader.php using 'use_include_path' = true. Make sure you include Zend Framework in your include_path which currently contains: .;C:\xampp\php\Zend\library\zend\;C:\xampp\php\PEAR;
It has already taken mine whole day to check other forums,get ideas but none of then works.Please help .Thanks
Your path should probably be C:\xampp\zend\library\Zend.
You shoulnd't take the framework to the global include path but have it as a dependency in your project, soon you'll have two projects with two different versions of ZF and then the global option creates troubles
Hi there finally after doing every possible tries,my error was gone.
I don't know other cases but in my case i have done a series of mistake.So as i corrected them the error was gone.Here is what i did
1.In ZendFramework-2.0.5 the loader.php was missing.So following error occured
Exception thrown trying to access Zend/Loader.php using 'use_include_path' = true. Make sure you include Zend Framework in your include_path which currently contains: .;C:\xampp\php\Zend\library\zend\;C:\xampp\php\PEAR;
For this i downloaded the ZendFramework-1.12.0(only in my case).And Loader.php was there
2.No two mistake of mine was i fractured the path from half.
i.e.If my folder structure was like
ZendFramework-1.12.0/library/Zend/..I add the half path to php.ini file
include_path = ".;C:\xampp\php\PEAR\;C:\xampp\php\Zend;"
which was a mistake so i, gave the path before the library folder
include_path = ".;C:\xampp\php\PEAR\;C:\xampp\php\Zend\library;"
and placed the folders according to path.
3.And what about environmental variables i read about?
They are not neccessary while installing the ZendFramework for the first time.After it i am not in that condn to say whether it should be added or not environmantal variables
C:\xampp\php
So,after doing above mentioned corrections and checking through the installation checker the error was gone.
And remember to restart(start and stop) the apache server after a tiny change in php.ini file.
thanks to markus-tharkun and Seth Battin a lot.You saved me.

failing to include the path in php.ini

I am trying to include this path to the zend framework, but failing:
include_path = ".;C:\ZendFramework-1.11.11\ZendFramework-1.11.11\library"
should the Zendframework reside in a different folder?
UPDATE
It works now.. I typed zf show version.
I want to set the thing to as an environmental variable, which means that no matter from where I will type the command in the command line... zf show version will work..
I went to to the environment variables by clicking the right button on my computer, and then navigating to Environment variable and setting the path like this.
zf show version
variable name: Temp
variable path: %USERPROFILE%\Local Settings\Temp;C:\xampp\php;
Basically, I want to set C:\xampp\php as a default so that I wont need to navigate to the directory each time i start the command line
No, Zendframework doesn't have to reside in a different folder.
Your include_path is right and should has worked.
Is it that your path Zend library path is not right?
what is the error your got?

Cakephp 2.0.4 bake error

I tried bake with Cakephp 2.0.4 stable with 'cake bake' command
But it's giving me below errors...
Unable to set console path for app/Console.
CakePHP is on your `include_path`. CAKE_CORE_INCLUDE_PATH will be set, but commented out.
Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in /home/wmetools/public_html/security/app/Console/myapp/webroot/index.php
Project baked but with some issues..
Your database configuration was not found. Take a moment to create one.
Is there a reason why this is happening?
If you meant to say
CakePHP is not on your include_path
** Code from the webroot/index.php file **
For ease of development CakePHP uses PHP's include_path. If you
cannot modify your include_path set this value.
Setting the include path will get rid of this error. There are two ways to accomplish this:
Edit your php ini file (on wamp this would be WAMPMENU->PHP->php.ini)
Better Description on how to.
or
// THIS METHOD IS NOT RECOMMENDED FOR THIS SITUATION
1. ini_set("include_path", ".:../:./include:../include");
If you do not want to mess with all that, just set the include path manually in the index.php file.

Deployment with Capistrano

I am trying to get into PHP app deployment with Capistrano. I have two config files that I need to be "edited" depending on where I deploy it. It's basic stuff like database name and root url (Codeigniter). Can I make Capistrano edit specified automatically? Let's say I want to edit the following in the file /system/config/edit.php:
$test = '';
// edit to
$test = 'Hello World';
Thanks,
Max
What I generally do in this kind of situation (even though I don't use Capistrano) is to have several config files commited to source control.
For instance :
config.php for development machines
this file is the one that's always used by the application
config.testing.php
config.staging.php
config.production.php
And when deploying the application to the server, I just have to copy the file corresponding to the current environment to "config.php" -- as this one is the one that's always used by the application.
It means that I have to do a file copy during the build process, yes, but :
it means there is no need for any search and replace, that can break
it also means every config files are commited to SVN (or whatever source control software you are using)
If your configuration files become too complex, and duplicate lots of stuff, you can think about having one "default" config file, that's always included, and sub-config files that only define what depends on the environment.
What that, what I said before still stands : just include the "default" file at the begining of each other.
My Unix is knowledge isn't quite up to scratch so I can't quite get the syntax perfect for what you want. However, Capistrano allows you to directly use the Unix command-line by invoking :run_method within your configs.
The Capistrano code might look something like the following:
run "grep -R --files-with-matches '$test = "";' /system/config/ | xargs perl -pi~ -e 's/\$test = "";/$test = "Hello World";/'"
I would check up on that find and replace function working as expected before implementing it live though.
If you need any more help, I'd recommend checking out the Capistrano Handbook, it should answer most of your questions.

Categories