Categories
Zend Framework

Add custom, xml defined routing in Zend Framework

Sometimes, in Zend Framework, you need to add custom routes in your web application. One of the options is to define the routes in a XML file and load it from the bootstrap.

The advantage of this approach for routing is that you add your routes in the XML file, without the need to touch the PHP code, which makes it very easy for the web app itself to generate or update the routes. This is very useful when when you building a CMS or some SEO related functionality, because you can allow the customer to set their own worded urls according to their SEO optimization strategies.

Categories
PHP Web Development

Drupal Resources

20 Drupal Modules to Boost Your Website’s Functionality

Categories
PHP

PHP redirect with POST

To send a POST query form a PHP script:

To make a redirect with sending also the POST query submitted to the current PHP script:

And of course THE ALTERNATIVE solution can come handy in hard times 😉

Categories
PHP

PHP SOAP client error: SoapFault exception: [Client] Function (“yourMethod”) is not a valid method for this service

When you are creating a SOAP web service and call it like:

$client=new SoapClient(‘http://doman/service?wsdl’);
echo $client->yourmethod(‘string param’);

You can encounter an error like:

SoapFault exception: [Client] Function (“yourMethod”) is not a valid method for this service

although you have the method implemented in your web service and it is properly displayed in your WSDL file.

Be aware that PHP caches the WSDL locally for better performance. You can disable the caching via php.ini/.htaccess completely or remove the cache file (/tmp/wsdl-.. if you are on Linux) to force regeneration of it.

Categories
Linux PHP Web Development

PhpMyAdmin increase import file limit size

Starting with version 2.7.0, the import engine has been re–written and these problems should not occur. If possible, upgrade your phpMyAdmin to the latest version to take advantage of the new import features.

The first things to check (or ask your host provider to check) are the values of upload_max_filesize, memory_limit and post_max_size in the php.ini configuration file. All of these three settings limit the maximum size of data that can be submitted and handled by PHP. One user also said that post_max_size and memory_limit need to be larger than upload_max_filesize.

There exist several workarounds if your upload is too big or your hosting provider is unwilling to change the settings:

* Look at the $cfg[‘UploadDir’] feature. This allows one to upload a file to the server via scp, ftp, or your favorite file transfer method. PhpMyAdmin is then able to import the files from the temporary directory. More information is available in the Configuration section of this document.
* Using a utility (such as BigDump) to split the files before uploading. We cannot support this or any third party applications, but are aware of users having success with it.
* If you have shell (command line) access, use MySQL to import the files directly. You can do this by issuing the “source” command from within MySQL: source filename.sql.

Categories
PHP Web Development

Install SVN/Subversion support to Eclipse PDT

The project url:
http://subclipse.tigris.org/

Add the plugin using:
Help > Install New Software … >  and in the text box type: http://subclipse.tigris.org/update_1.6.x
(if you are using Galileo+)

If you are using another version of Eclipse PDT, please check the list below to get the proper version of Subclipse plugin.

Name: Subclipse 1.6.x (Eclipse 3.2+)
URL:  http://subclipse.tigris.org/update_1.6.x

Name: Subclipse 1.4.x (Eclipse 3.2+)
URL:  http://subclipse.tigris.org/update_1.4.x

Name: Subclipse 1.2.x (Eclipse 3.2+)
URL:  http://subclipse.tigris.org/update_1.2.x

Name: Subclipse 1.0.x (Eclipse 3.0/3.1)
URL:  http://subclipse.tigris.org/update_1.0.x

If you install this on Window it goes OK and runs smoothly. However, if you install it on Linux, Ubuntu for example, you’ll have some problems, because of the javaHL library that is used and is not properly installed and its path added to the eclipse search paths.

So, to make the Subversion plugin run on Ubuntu, you have t0 install the javaHL library:


$ apt-get install libsvn-java

and add it’s path to the eclipse.ini:


$ sudo nano /usr/local/eclipse/eclipse.ini

and add this line in the .INI file:

-Djava.library.path=/usr/lib/jni

For more info on troubleshooting Subversion plugin install, please check here.

Categories
PHP Web Development

Get web page content with PHP when you are behind a proxy

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “http://example.com”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, “proxyname”);
curl_setopt($ch, CURLOPT_PROXYPORT, 8080);
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, “username:password”);
$pageContent = curl_exec($ch);
curl_close($ch);
Categories
Linux PHP

Install XDebug on Ubuntu / Debian

More updated info:
http://wylbur.us/2014-06-17-add-xdebug-to-ubuntu-1404

> sudo apt-get install php5-xdebug

> sudo nano /etc/php5/conf.d/xdebug.ini
zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp

Or, it can be added to php.ini and extended, like this:

And very important! enable the following options in php.ini: